Skip to content

Commit 11bb89c

Browse files
PhillipDowneythemoenenMoenen ErbuerPhil Downey
authored
Skypilot upgrade to Main (#56)
* Basic persistent GUI server prototype in separate thread * Added install and launch gui commands * gui api * gui api updates * Added GUI api endpoints * Remove openad-gui files from git * stash * stash laptop * demo prototype * stash * switch workspace GUI API * Added hydrogen atoms to 3d coordinates data * Websocket experiment * created filesystem worker and refactored 'list files' command to use the same method as the GUI api, plus added optional path parameter * Refactored fs_get_file and fs_get_workspace files to follow similar data structure and moved fileType logic to backend * stash * Before removing index_only functionality from get_molset() * Indexing done right wip * Stash * stash before refactoring molset fs/cache reading * sdf processing + api refactor * added 'enriched' parameter to molecule object * fixed list files * Removed old messy molecule API functions * implemented reverse sort * Support for invalid file paths and smiles in .smi files * stash * various * cleanup & debugging * Mega commit regarding persistent GUI updates * RXN login error message update * updated grammar in models to allow auth_group and service name without quotes * Merged conflicts #2 * fix for unspported PDF viewing * changed host for flask apps to 0.0.0.0 * changed host for flask apps to 0.0.0.0 port 5005 starter * cleaned up molecules * adding auth group to catalog model service * adding auth group to catalog model service * fix opena api session management * fine tune jupyter install * install update * install update * install update * fix openad rxn api session management * fix openad rxn api session management * Added command to show working set molecules * stash * Added openad-gui build folder * stash show_molset * Moved openad-gui folder inside openad folder so it is part of pip install, renamed to gui-build * Added gui-build folder * Move to port 0.0.0.0 * New place for the gui-build dir, updated to latest version * show molset command + updated gui launch/shutdown messages * Centralized duplicate normalize_mol_df and _smiles_to_iupac functions into mol_functions * mymols fix * debugged dataviewer display and updated notebooks * debugged dataviewer display and updated notebooks * enabled append for loading molecules * First step for command * Remove icloud duplicate files * formatting and fox new_molecule bug * merge properties bug * gui notebook and readme * markdown test * readme & gui demo * gui readme update * stash * Support for display molecules from a dataframe * stash * prox server major upgrade and debug visuals * prox server major upgrade and debug visuals * prox server major upgrade and debug visuals * stash * Undid renaming gui-build to gui-build-proxy * paths for routes * acheived build * merge conflicts mergibg with gui_api_moe #2 * Merge conflicts #3 * Merge wrapup * Simplified/cleaned up JL_PROXY proxy code in gui_launcher * Demo Notebook design * patch launcher * notebook updates * stash * gui-build & gui-build-proxy wip * Updated gui build folders * Updated gui build folders * New gui build * notebook upgrade * fine tuning anf testing * fine tuning anf testing * added warning for parameters in service call order * added warning for parameters in service call order * linter * readme fix --------- Co-authored-by: Moenen Erbuer <moenen@shapish.com> Co-authored-by: Moenen Erbuer <moenen@arthur.io> Co-authored-by: Phil Downey <phildowney@pd-work-mac.local> Co-authored-by: Moenen Erbuer <moenen.erbuer@ibm.com>
1 parent 54435c7 commit 11bb89c

371 files changed

Lines changed: 50078 additions & 22713 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,16 @@ for (var i=0; i< urls.length; i++) {
2323
2424
-->
2525

26+
2627
# OpenAD Beta
2728
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/openad)](https://pypi.org/project/openad/)
2829
[![PyPI version](https://img.shields.io/pypi/v/openad)](https://pypi.org/project/openad/)
2930
[![License MIT](https://img.shields.io/github/license/acceleratedscience/open-ad-toolkit)](https://opensource.org/licenses/MIT)
3031
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
3132
[![Docs](https://img.shields.io/badge/website-live-brightgreen)](https://acceleratedscience.github.io/openad-docs/)
3233

34+
35+
3336
**Open Accelerated Discovery Client**<br>
3437
[Documentation](https://acceleratedscience.github.io/openad-docs/)
3538

@@ -39,17 +42,20 @@ The goal of openAD is to provide a common language for scientists to interact wi
3942

4043
---
4144
> **Pre-install Note:**
42-
For updating to 0.3.0 or above first remove toolkits `remove toolkit DS4SD` and `remove toolkit RXN` prior to updating
45+
For updating to 0.4.0 or above first remove toolkits `remove toolkit DS4SD` and `remove toolkit RXN` prior to updating
4346

4447
> **Whats New ?**
4548
- `%Openadd` has been added to the magic commands to provide pure data type results for data returning commands
46-
- Upgraded IBM BAM model support for latest IBm generative AI embeddings and Langchain
49+
- Upgraded skypilot to 0.6.0
50+
- Support for deploying in OpenSHift AI / Open Data hub workbench or podman/docker image `https://github.com/acceleratedscience/openad_workbench`
51+
- Support for Application API
4752
- Property and Data Set Generation Services
4853
We support the following Model Services
4954
- GT4SD Generation Services `git@github.com:acceleratedscience/generation_inference_service.git`
5055
- GT4SD Property Services `git@github.com:acceleratedscience/property_inference_service.git`
5156
- GT4SD MoleR Generation `git@github.com:acceleratedscience/moler_inference_service.git`
5257
- GT4SD Molformer `git@github.com:acceleratedscience/molformer_inference_service.git`
58+
5359
Pre-Requisite is that you have a AWS Account and can launch your own EC2 Instances Or someone else can launch them for you and you can catalog a Remote Service via URL.
5460

5561
**Example:**

_for_testing/Demonstration.ipynb

Lines changed: 19 additions & 248 deletions
Large diffs are not rendered by default.

_for_testing/test_everything.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,9 @@
257257
],
258258
"metadata": {
259259
"kernelspec": {
260-
"display_name": "ad-venv",
260+
"display_name": "venv",
261261
"language": "python",
262-
"name": "ad-venv"
262+
"name": "venv"
263263
},
264264
"language_info": {
265265
"codemirror_mode": {
@@ -271,7 +271,7 @@
271271
"name": "python",
272272
"nbconvert_exporter": "python",
273273
"pygments_lexer": "ipython3",
274-
"version": "3.11.3"
274+
"version": "3.11.2"
275275
}
276276
},
277277
"nbformat": 4,

docs/generate_docs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from openad.plugins.style_parser import tags_to_markdown
3535
from openad.helpers.output import output_error, output_text, output_success
3636
from openad.helpers.output_msgs import msg
37-
from openad.helpers.general import open_file, write_file
37+
from openad.helpers.files import open_file, write_file
3838

3939
# Get the repo path, this python file's parent folder.
4040
REPO_PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
@@ -202,9 +202,9 @@ def _parse_description(description):
202202
# be treated as part of the blockquote.
203203
description = re.sub(
204204
r"(\*\*Note:\*\*.+?)(\n{1,})",
205-
lambda match: f" > {match.group(1)}\n\n"
206-
if len(match.group(2)) == 1
207-
else f" > {match.group(1)}{match.group(2)}",
205+
lambda match: (
206+
f" > {match.group(1)}\n\n" if len(match.group(2)) == 1 else f" > {match.group(1)}{match.group(2)}"
207+
),
208208
description,
209209
flags=re.MULTILINE,
210210
)

docs/output/csv/commands.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ get workspace [ <workspace_name> ];Workspaces
66
create workspace <workspace_name> [ description('<description>') on path '<path>' ];Workspaces
77
remove workspace <workspace_name> ;Workspaces
88
list workspaces;Workspaces
9-
add molecule <name> | <smiles> | <inchi> | <inchikey> | <cid> [ as '<name>' ] [ basic ] [force ];Molecules
9+
add molecule <name> | <smiles> | <inchi> | <inchikey> | <cid> [ as '<name>' ] [ basic ] [ force ];Molecules
1010
display molecule <name> | <smiles> | <inchi> | <inchikey> | <cid>;Molecules
1111
display sources <name> | <smiles> | <inchi> | <inchikey> | <cid>;Molecules
1212
rename molecule <molecule_identifer_string> as <molecule_name>;Molecules

docs/output/markdown/commands.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ To update it, see openad/docs/generate_docs.py
3030
- [Search Collections](#search-collections)
3131
- [Collections](#collections)
3232
- [RXN](#rxn)
33-
- [General](#general)
33+
- [General](#general-1)
3434
- [Retrosynthesis](#retrosynthesis)
3535
- [Prediction](#prediction)
3636
- [ST4SD](#st4sd)
@@ -77,8 +77,8 @@ Lists all your workspaces. <br><br>
7777

7878
### Molecules
7979

80-
`add molecule <name> | <smiles> | <inchi> | <inchikey> | <cid> [ as '<name>' ] [ basic ] [force ]`{: .cmd }
81-
This command is how you add a molecule to a current working list of molecules in memory. When adding a molecule by name, this name will become the molecule's identifying string. <br>
80+
`add molecule <name> | <smiles> | <inchi> | <inchikey> | <cid> [ as '<name>' ] [ basic ] [ force ]`{: .cmd }
81+
This command is how you add a molecule to a current working list of molecules in memory. When adding a molecule by name, this name will become the molecule's identifying string. <br>
8282

8383
It will take any molecules identifier from the following categories: <br>
8484
-`smiles ` <br>

openad/app/magic/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from openad.app.magic.openad import AD
1+
from openad.app.magic.openad_magic import AD
22

33

44
def load_ipython_extension(ipython):

openad/app/main.py

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111
import uuid
1212
from cmd import Cmd
1313
from pandas import DataFrame
14+
import atexit
1415

1516
# Main
1617
from openad.app.main_lib import lang_parse, initialise, set_context, unset_context
1718
from openad.toolkit.toolkit_main import load_toolkit
1819
from openad.app import login_manager
20+
from openad.gui.gui_launcher import gui_init, GUI_SERVER, gui_shutdown
21+
from openad.gui.ws_server import ws_server # Web socket server for gui - experimental
1922
from openad.helpers.output import output_table
2023

2124
# Core
@@ -41,6 +44,7 @@
4144
from openad.helpers.output_msgs import msg
4245
from openad.helpers.general import refresh_prompt
4346
from openad.helpers.splash import splash
47+
from openad.helpers.files import empty_trash
4448
from openad.helpers.output_content import info_workspaces, info_toolkits, info_runs, info_context
4549

4650
# Globals
@@ -57,6 +61,7 @@
5761
import inspect
5862
import importlib
5963

64+
6065
MAGIC_PROMPT = None
6166
PLUGIN_CLASS_LIST = []
6267
installed_packages = pkg_resources.working_set
@@ -138,19 +143,6 @@ class RUNCMD(Cmd):
138143
molecule_list = []
139144
last_external_molecule = None
140145

141-
def workspace_path(self, workspace: str):
142-
"""Returns the default workspace directory path"""
143-
try:
144-
x = os.path.expanduser(self.settings["paths"][workspace.upper()] + "/" + workspace.upper())
145-
return x
146-
except Exception: # pylint: disable=broad-exception-caught
147-
# various exceptions can cause this... Any error results in same outcome
148-
return os.path.expanduser(_meta_workspaces + "/" + workspace.upper())
149-
150-
def set_workspace_path(self, workspace: str, path: str):
151-
"""Sets the current workspace path in the settings dictionary"""
152-
self.settings["paths"][workspace.upper()] = os.path.expanduser(path)
153-
154146
# Initialises the class for Run command.
155147
def __init__(self, completekey="Tab", api=False):
156148
super().__init__()
@@ -215,6 +207,20 @@ def __init__(self, completekey="Tab", api=False):
215207

216208
output_train_statements(self)
217209

210+
def workspace_path(self, workspace: str = None):
211+
"""Returns the default workspace directory path"""
212+
workspace = workspace.upper() if workspace else self.settings["workspace"].upper()
213+
try:
214+
x = os.path.expanduser(self.settings["paths"][workspace.upper()] + "/" + workspace.upper())
215+
return x
216+
except Exception: # pylint: disable=broad-exception-caught
217+
# various exceptions can cause this... Any error results in same outcome
218+
return os.path.expanduser(_meta_workspaces + "/" + workspace.upper())
219+
220+
def set_workspace_path(self, workspace: str, path: str):
221+
"""Sets the current workspace path in the settings dictionary"""
222+
self.settings["paths"][workspace.upper()] = os.path.expanduser(path)
223+
218224
def do_help(self, inp, display_info=True, starts_with_only=False, **kwargs):
219225
"""CMD class called function:
220226
Display help about a command, for example 'list'.
@@ -605,8 +611,13 @@ def complete(self, text, state):
605611
# Catches the exit command
606612
def do_exit(self, dummy_inp_do_not_remove):
607613
"""CMD Funcion: called on exit command"""
614+
try:
615+
cleanup()
616+
except:
617+
pass
608618
write_registry(self.settings, self, True)
609619
delete_session_registry(self.session_id)
620+
610621
# exiting the application. Shorthand: x q.
611622
return True
612623

@@ -821,7 +832,7 @@ def error_first_word_grabber(error):
821832
return str(word)
822833

823834

824-
# Main execution application
835+
# Main execution application.
825836
# If the application is called with parameters, it executes the parameters.
826837
# If called without parameters, the command line enters the shell environment.
827838
# History is only kept for commands executed once in the shell.
@@ -844,6 +855,7 @@ def api_remote(
844855
- It is deliberate that the whole RUNCMD class object is not kept alive as there is no logical
845856
exit point for magic commands, unlike a command line.
846857
"""
858+
847859
global MAGIC_PROMPT
848860
# GLOBAL_SETTINGS["display"] = "notebook"
849861

@@ -859,6 +871,7 @@ def api_remote(
859871
MAGIC_PROMPT = magic_prompt
860872
else:
861873
magic_prompt = MAGIC_PROMPT
874+
862875
if api_context["workspace"] is None:
863876
api_context["workspace"] = magic_prompt.settings["workspace"]
864877
else:
@@ -938,6 +951,9 @@ def cmd_line():
938951
a_space = " "
939952
try:
940953
command_line = RUNCMD()
954+
# Launch the GUI if it is installed.
955+
# gui_init(command_line)
956+
# ws_server(command_line) # Experimental
941957
except KeyboardInterrupt:
942958
output_error(msg("err_key_exit_before_init"))
943959
return
@@ -1000,15 +1016,25 @@ def cmd_line():
10001016
# The cmdloop parameter controls the startup screen, it overrides self.intro.
10011017
command_line.cmdloop(splash(command_line.settings["context"], command_line, startup=True))
10021018
lets_exit = True
1019+
10031020
except KeyboardInterrupt:
10041021
command_line.postloop()
1022+
10051023
if confirm_prompt("Are you sure you wish to exit?", default=True):
1024+
# from openad.gui.gui_launcher import gui_shutdown
1025+
empty_trash(command_line)
10061026
lets_exit = True
10071027
command_line.do_exit("dummy do not remove")
1028+
10081029
except Exception as err: # pylint: disable=broad-exception-caught
10091030
# We do not know what the error could be, so no point in being more specific.
10101031
output_error(msg("err_invalid_cmd", err), command_line)
10111032

10121033

1034+
def cleanup():
1035+
gui_shutdown(ignore_warning=True)
1036+
1037+
1038+
atexit.register(cleanup)
10131039
if __name__ == "__main__":
10141040
cmd_line()

0 commit comments

Comments
 (0)