Skip to content

Commit

Permalink
Merge pull request #128 from MichaelPesce/1.0.0rc0
Browse files Browse the repository at this point in the history
1.0.0rc0 updates
  • Loading branch information
MichaelPesce authored Jul 22, 2024
2 parents f21cfb1 + 6e0be59 commit 397421d
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 263 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/electron-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: App build
on:
push:
branches:
- "new-charts"
- "1.0.0rc0"

defaults:
run:
Expand Down Expand Up @@ -31,6 +31,11 @@ jobs:
run: |
dotnet tool install --global AzureSignTool
- name: Add theme to .env file
working-directory: ./electron/ui
run: |
echo REACT_APP_THEME=watertap >> .env
- name: Install Electron JS dependencies
run: |
npm --prefix electron clean-install
Expand All @@ -42,9 +47,9 @@ jobs:
- name: Get idaes extensions
run: idaes get-extensions

- name: Install adudchenko/generic treatment train Watertap
- name: Install Watertap locally
working-directory: ../
run: git clone https://github.com/avdudchenko/watertap.git && cd watertap && git fetch --all --tags && git checkout generic_treatment_train && pip install --progress-bar off .
run: git clone https://github.com/watertap-org/watertap.git && cd watertap && git fetch --all --tags && git checkout 1.0.0rc0 && pip install --progress-bar off .

- name: Transfer Entry points
run: |
Expand All @@ -65,7 +70,7 @@ jobs:

- name: Sign Windows Distribution
run: |
AzureSignTool sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.digicert.com -v electron/dist/WaterTAP-UI_24.05.17_win64.exe
AzureSignTool sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.digicert.com -v electron/dist/WaterTAP-UI_24.07.16_win64.exe
- name: Upload artifact for windows build
Expand All @@ -74,4 +79,4 @@ jobs:
with:
name: windows-dist
path: |
electron/dist/WaterTAP-UI_24.05.17_win64.exe
electron/dist/WaterTAP-UI_24.07.16_win64.exe
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ jobs:
activate-environment: watertap-ui-env
miniforge-version: latest

- name: Add theme to .env file
working-directory: ./electron/ui
run: |
echo REACT_APP_THEME=watertap >> .env
- name: Install Electron JS dependencies
run: |
npm --prefix electron clean-install
Expand Down
109 changes: 23 additions & 86 deletions backend/app/main-hooks/hook-watertap.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# add all modules to watertap modules hidden imports

for package in ["watertap", "pyomo"]:
for package in ["watertap", "pyomo", "scipy"]:
pkg = importlib.import_module(package)
try:
# base_folder = Path(pkg.__path__[0])
Expand Down Expand Up @@ -97,8 +97,9 @@
except Exception as err: # assume the import could do bad things
print(f"Import of file '{yaml_file}' failed: {err}")
continue

datas.append((src_name, "watertap/core"))
hiddenimports = list(imports)
# hiddenimports.append("pyomo.common.dependencies.numpy")
# print("hiddenimports")
# print(hiddenimports)
# # manually add all pyomo hidden imports
Expand All @@ -110,90 +111,26 @@
"sys",
"logging",
"re",
"sys",
"pyomo.contrib.ampl_function_demo.plugins",
"pyomo.contrib.appsi.plugins",
"pyomo.contrib.community_detection.plugins",
"pyomo.contrib.example.plugins",
"pyomo.contrib.fme.plugins",
"pyomo.contrib.gdp_bounds.plugins",
"pyomo.contrib.gdpopt.plugins",
"pyomo.contrib.gjh.plugins",
"pyomo.contrib.mcpp.plugins",
"pyomo.contrib.mindtpy.plugins",
"pyomo.contrib.multistart.plugins",
"pyomo.contrib.preprocessing.plugins",
"pyomo.contrib.pynumero.plugins",
"pyomo.contrib.trustregion.plugins",
"pyomo.repn.util",
"pyomo.contrib.gdpbb",
"pyomo.contrib.gdpbb.plugins",
"pyomo",
"pyomo.environ",
"pyomo.age",
"pyomo.bilevel",
"pyomo.bilevel.plugins",
"pyomo.core",
"pyomo.core.plugins",
"pyomo.dae",
"pyomo.dae.plugins",
"pyomo.gdp",
"pyomo.gdp.plugins",
"pyomo.neos",
"pyomo.neos.plugins",
"pyomo.opt",
"pyomo.opt.plugins",
"pyomo.pysp",
"pyomo.pysp.plugins",
"pyomo.solvers.plugins",
"pyomo.solvers",
"pyomo.checker",
"pyomo.checker.plugins",
"pyomo.contrib",
"pyomo.contrib.plugins",
"pyomo.contrib.solver",
"pyomo.contrib.solver.plugins",
"pyomo.dataportal",
"pyomo.dataportal.plugins",
"pyomo.duality",
"pyomo.duality.plugins",
"pyomo.kernel",
"pyomo.kernel.plugins",
"pyomo.mpec",
"pyomo.mpec.plugins",
"pyomo.network",
"pyomo.network.plugins",
"pyomo.repn",
"pyomo.repn.plugins",
"pyomo.scripting",
"pyomo.scripting.plugins",
"pyomo.util",
"pyomo.util.plugins",
"pyomo.common",
"pyomo.common.plugins",
"pyomo.common.dependencies",
"pyomo.core.expr.numvalue",
"pyomo.core.expr.numvalue",
"pyomo.solvers.plugins.solvers.direct_solver",
"pyomo.solvers.plugins.solvers.direct_or_persistent_solver",
"pyomo.core.kernel.component_set",
"pyomo.core.kernel.component_map",
"pyomo.opt.results.results_",
"pyomo.opt.results.solution",
"pyomo.opt.results.solver",
"pyomo.opt.base",
"pyomo.core.base.suffix",
"pyomo.core.base.var",
"pyomo.core.base.PyomoModel",
"pyomo.solvers.plugins.solvers.persistent_solver",
"pyomo.opt.base.problem",
"pyomo.opt.base.convert",
"pyomo.opt.base.formats",
"pyomo.opt.base.results",
"pyomo.core.base.block",
"pyomo.core.kernel.block",
"pyomo.core.kernel.suffix",
"pyomo.contrib.cp.plugins",
"pkg_resources.extern",
"pyomo.common.dependencies.numpy",
"collections.abc",
"types",
"pyutilib",
"pyutilib.component",
"importlib.abc",
"importlib",
"ctypes",
"random",
"yaml",
"numpy",
"scipy._lib.array_api_compat.numpy.fft",
"scipy._lib.array_api_compat.numpy",
"scipy._lib.array_api_compat",
"scipy._lib.",
"scipy.sparse",
"scipy.special._special_ufuncs",
"scipy.special._cdflib",
"scipy.special",
]

hiddenimports.extend(pyomo_imports)
7 changes: 7 additions & 0 deletions backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
import multiprocessing
import idaes.logger as idaeslog

## Put DeferredImportCallbackFinder at the end of sys.meta_path list
DeferredImportCallbackFinder = [finder for finder in sys.meta_path if "pyomo.common.dependencies" in repr(finder)]
if len(DeferredImportCallbackFinder) > 0:
DeferredImportCallbackFinder=DeferredImportCallbackFinder[0]
sys.meta_path[:] = [finder for finder in sys.meta_path if "pyomo.common.dependencies" not in repr(finder)]
sys.meta_path.append(DeferredImportCallbackFinder)

SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))

Expand Down
4 changes: 2 additions & 2 deletions electron/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions electron/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "watertap-ui",
"author": "Michael Pesce <mpesce@lbl.gov>",
"version": "24.05.17",
"version": "24.07.16",
"private": true,
"main": "build/main.js",
"dependencies": {
Expand Down Expand Up @@ -71,7 +71,7 @@
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true,
"artifactName": "WaterTAP-UI_24.05.17_win64.exe"
"artifactName": "WaterTAP-UI_24.07.16_win64.exe"
},
"deb": {
"depends": [
Expand Down Expand Up @@ -107,7 +107,7 @@
"win": {
"target": "nsis",
"icon": "build/nawi-logo.ico",
"artifactName": "WaterTAP-UI_24.05.17_win64.exe"
"artifactName": "WaterTAP-UI_24.07.16_win64.exe"
},
"linux": {
"target": "Deb",
Expand Down
29 changes: 15 additions & 14 deletions electron/ui/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,33 @@ import {themes} from './theme';
function App() {
let navigate = useNavigate();
const [hasFlowsheetsList, setHasFlowsheetsList] = useState(false);
const [hasTheme, setHasTheme] = useState(false);
const [hasTheme, setHasTheme] = useState(true);
const [numberOfSubprocesses, setNumberOfSubprocesses] = useState({})
const [theme, setTheme] = useState(null);
const [theme, setTheme] = useState(themes[process.env.REACT_APP_THEME]);
const [checkAgain, setCheckAgain] = useState(1)
const WAIT_TIME = 2

console.log("App hasTheme = ",hasTheme);

useEffect(() => {
// Set the theme
if (!hasTheme) {
getProjectName().then((name) => {
console.debug("setting theme: name=", name, "value=", themes[name]);
setTheme(themes[name]);
setHasTheme(true);
})
}

if (hasTheme && checkAgain !== 0)
{
// Get list of flowsheets
if (!hasFlowsheetsList) {
getFlowsheetsList()
.then((data) => {
console.log("got flowsheets list")
setHasFlowsheetsList(true);
// navigate('/flowsheets', {replace: true});
setCheckAgain(0)
}).catch((e) => {
// console.log(`unable to get flowsheets, trying again in ${WAIT_TIME} seconds`)
// if its taking a long time log the error
if (checkAgain > 10) console.log(`get flowsheets failed: ${e}`)
setTimeout(() => {
setCheckAgain(checkAgain+1)
}, WAIT_TIME * 1000)
});
}
});
}, [theme, checkAgain]);

const subProcState = {value: numberOfSubprocesses, setValue: setNumberOfSubprocesses}
return (
Expand Down
Loading

0 comments on commit 397421d

Please sign in to comment.