From e7136dfa56266f25efdb2a713aeee41583307fa3 Mon Sep 17 00:00:00 2001 From: Corey Krewson Date: Wed, 20 Dec 2023 09:21:54 -0600 Subject: [PATCH 1/4] use tethysapp/conda-package-publish-action removed various print statements fixed bug where syncstores was running on uninstall for consistency, updated conda search to use conda python api updated conda bash files to use micromamba removed default store json with sensitive info --- .github/workflows/main.yml | 2 +- tethysapp/app_store/controllers.py | 2 -- tethysapp/app_store/installation_handlers.py | 5 ++- tethysapp/app_store/resource_helpers.py | 14 +++++--- tethysapp/app_store/scripts/conda_install.sh | 2 +- .../app_store/scripts/mamba_uninstall.sh | 2 +- tethysapp/app_store/scripts/mamba_update.sh | 2 +- .../workspaces/app_workspace/__init__.py | 0 .../workspaces/app_workspace/stores copy.json | 24 ------------- .../workspaces/app_workspace/stores.json | 25 ------------- .../workspaces/app_workspace/stores_copy.json | 35 ------------------- 11 files changed, 15 insertions(+), 98 deletions(-) create mode 100644 tethysapp/app_store/workspaces/app_workspace/__init__.py delete mode 100644 tethysapp/app_store/workspaces/app_workspace/stores copy.json delete mode 100644 tethysapp/app_store/workspaces/app_workspace/stores.json delete mode 100644 tethysapp/app_store/workspaces/app_workspace/stores_copy.json diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2edda27..1819dac 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: run: | python ./conda.recipes/getChannels.py > build_command.txt - name: publish-to-conda - uses: romer8/conda-package-publish-action@master + uses: tethysapp/conda-package-publish-action@master with: subDir: 'conda.recipes' AnacondaToken: ${{ secrets.ANACONDA_TOKEN }} diff --git a/tethysapp/app_store/controllers.py b/tethysapp/app_store/controllers.py index 196a38b..8326d9a 100755 --- a/tethysapp/app_store/controllers.py +++ b/tethysapp/app_store/controllers.py @@ -34,8 +34,6 @@ def home(request,app_workspace): # with open(available_stores_json_path) as available_stores_json_file: # available_stores_data_dict = json.load(available_stores_json_file)['stores'] - print(available_stores_data_dict) - context = { 'storesData':available_stores_data_dict, 'show_stores': True if len(available_stores_data_dict) > 0 else False diff --git a/tethysapp/app_store/installation_handlers.py b/tethysapp/app_store/installation_handlers.py index aca689a..228daa2 100644 --- a/tethysapp/app_store/installation_handlers.py +++ b/tethysapp/app_store/installation_handlers.py @@ -54,7 +54,7 @@ def restart_server(data, channel_layer, app_workspace, run_collect_all=True): os.remove(scaffold_running_path) manage_path = get_manage_path({}) - if "install" in data["restart_type"] or "update" in data["restart_type"]: + if data["restart_type"] in ["install", "update", "github_install"]: # Run SyncStores logger.info("Running Syncstores for app: " + data["name"]) send_notification("Running Syncstores for app: " + data["name"], channel_layer) @@ -72,8 +72,7 @@ def restart_server(data, channel_layer, app_workspace, run_collect_all=True): else: - if run_collect_all and (data["restart_type"] == "install" or data["restart_type"] == "github_install" or - data["restart_type"] == "update"): + if run_collect_all and data["restart_type"] in ["install", "update", "github_install"]: logger.info("Running Tethys Collectall") send_notification("Running Tethys Collectall for app: " + data["name"], channel_layer) diff --git a/tethysapp/app_store/resource_helpers.py b/tethysapp/app_store/resource_helpers.py index 6f7e2f2..852d1ea 100644 --- a/tethysapp/app_store/resource_helpers.py +++ b/tethysapp/app_store/resource_helpers.py @@ -15,6 +15,7 @@ import subprocess from .utilities import get_available_stores_values from .helpers import add_if_exists, check_if_app_installed,add_if_exists_keys, logger +from conda.cli.python_api import run_command as conda_run, Commands CACHE_KEY = "" # CACHE_KEY = "warehouse_app_resources" @@ -268,16 +269,19 @@ def fetch_resources_new(app_workspace, refresh=False, conda_package="tethysapp", CACHE_KEY = cache_key - cache.get(CACHE_KEY) if (cache.get(CACHE_KEY) is None) or refresh: # Look for packages: logger.info("Refreshing list of apps cache") + + [resp, err, code] = conda_run(Commands.SEARCH, ["-c", CHANNEL_NAME, "--override-channels", "-i", "--json"]) - conda_search_result = subprocess.run(['conda', 'search', "-c", CHANNEL_NAME, "--override-channels", - "-i", "--json"], stdout=subprocess.PIPE) - - conda_search_result = json.loads(conda_search_result.stdout) + if code != 0: + # In here maybe we just try re running the install + raise( + f"ERROR: Couldn't search packages in the {CHANNEL_NAME} channel") + + conda_search_result = json.loads(resp) resource_metadata = [] logger.info("Total Apps Found:" + str(len(conda_search_result))) diff --git a/tethysapp/app_store/scripts/conda_install.sh b/tethysapp/app_store/scripts/conda_install.sh index ae56fcf..f28c38a 100755 --- a/tethysapp/app_store/scripts/conda_install.sh +++ b/tethysapp/app_store/scripts/conda_install.sh @@ -2,6 +2,6 @@ echo "Running Mamba Install" # mamba install -y --freeze-installed -q -c $2 -c tethysplatform -c conda-forge $1 -mamba install -y -q -c $2 -c tethysplatform -c conda-forge $1 +micromamba install -y --freeze-installed -q -c $2 -c tethysplatform -c conda-forge $1 echo "Mamba Install Complete" \ No newline at end of file diff --git a/tethysapp/app_store/scripts/mamba_uninstall.sh b/tethysapp/app_store/scripts/mamba_uninstall.sh index 18b6e97..8f5672e 100755 --- a/tethysapp/app_store/scripts/mamba_uninstall.sh +++ b/tethysapp/app_store/scripts/mamba_uninstall.sh @@ -1,5 +1,5 @@ #!/bin/bash echo "Running Mamba remove" -mamba remove -y --force -c tethysplatform --override-channels $1 +micromamba remove -y --force $1 echo "Mamba Remove Complete" diff --git a/tethysapp/app_store/scripts/mamba_update.sh b/tethysapp/app_store/scripts/mamba_update.sh index 012e566..5e74a77 100755 --- a/tethysapp/app_store/scripts/mamba_update.sh +++ b/tethysapp/app_store/scripts/mamba_update.sh @@ -1,5 +1,5 @@ #!/bin/bash echo "Running Mamba Update" -mamba install -y -q -c $2 -c tethysplatform -c conda-forge $1 +micromamba install -y -q -c $2 -c tethysplatform -c conda-forge $1 echo "Mamba Update Complete" \ No newline at end of file diff --git a/tethysapp/app_store/workspaces/app_workspace/__init__.py b/tethysapp/app_store/workspaces/app_workspace/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tethysapp/app_store/workspaces/app_workspace/stores copy.json b/tethysapp/app_store/workspaces/app_workspace/stores copy.json deleted file mode 100644 index f2ddf61..0000000 --- a/tethysapp/app_store/workspaces/app_workspace/stores copy.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "stores":[ - { - "conda_channel":"tethysapp", - "conda_labels":[ - "main" - ], - "github_organization":"tethysapp", - "github_token":"#45c0#a820f85aa11d727#f02c382#c91d63be83", - "default": true - }, - { - "conda_channel":"elkingio", - "conda_labels":[ - "main", - "dev" - ], - "github_organization":"lost_tribe", - "github_token":"#45c0#a820f85aa11d727#f02c382#c91d63be83", - "default": false - } - ] -} - diff --git a/tethysapp/app_store/workspaces/app_workspace/stores.json b/tethysapp/app_store/workspaces/app_workspace/stores.json deleted file mode 100644 index ab09cf1..0000000 --- a/tethysapp/app_store/workspaces/app_workspace/stores.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "stores":[ - { - "conda_channel":"tethysapp", - "conda_labels":[ - "main", - "dev" - ], - "github_organization":"tethysapp", - "github_token":"#45c0#a820f85aa11d727#f02c382#c91d63be83", - "default": true - }, - { - "conda_channel":"elkingio", - "conda_labels":[ - "main", - "dev" - ], - "github_organization":"lost-melancholic-tribe", - "github_token":"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", - "default": false - } - ] -} - diff --git a/tethysapp/app_store/workspaces/app_workspace/stores_copy.json b/tethysapp/app_store/workspaces/app_workspace/stores_copy.json deleted file mode 100644 index 65384e3..0000000 --- a/tethysapp/app_store/workspaces/app_workspace/stores_copy.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "stores": [ - { - "default": true, - "conda_labels": [ - "main", - "dev" - ], - "github_token": "gAAAAABj-CqGQzM2cZga_ISIPgyOFcR-uxHxtfqnqSs96XN210wAP4dPgKHWueKphMu3cXqMaIOpx49VzEblsJVkwhgUbphZ9WaSIKqEmqk2Bi_mf_hLgDX4EnvIpKqs5iDxOqo25vXi", - "conda_channel": "tethysapp", - "github_organization": "tethysapp" - }, - { - "default": false, - "conda_labels": [ - "main", - "dev" - ], - "github_token": "gAAAAABj_jTAaNDK1OAxfswFwQwpoYDd4NZzVgpV1H4ol2Zh2zrg9hPXtGHkKPfjHBRayw9wEkb3ByJwbOgk3Xj7iPJl_QC_VPxtoRuPIESl_jYuohoGlBbIdaU9tEH347Wqp9-7fg4i", - "conda_channel": "elkingio", - "github_organization": "lost-melancholic-tribe" - }, - { - "default": false, - "conda_labels": [ - "main", - "dev", - "test" - ], - "github_token": "gAAAAABkWrCzDnvIxtM2aWqvZTW7pKLbJuaEmci75hwiTllom58AvvbIKBE5mKz85mTcJ3hLd6YY45EmHm2cmjeZ_3ZFbubKZ5GJZbIvbTbBryvMxIA_M09ek7C7ZZG_8j3BFAZuTYLT", - "conda_channel": "NOAA-CIROH", - "github_organization": "NOAA-CIROH" - } - ] - } \ No newline at end of file From 205a9774a52012c9cb47705c1bcd5677a9d3070d Mon Sep 17 00:00:00 2001 From: Corey Krewson Date: Wed, 20 Dec 2023 09:55:37 -0600 Subject: [PATCH 2/4] updated main template to use tethysapp/conda-package-publish-action --- tethysapp/app_store/application_files/main_template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tethysapp/app_store/application_files/main_template.yaml b/tethysapp/app_store/application_files/main_template.yaml index e695898..441facf 100644 --- a/tethysapp/app_store/application_files/main_template.yaml +++ b/tethysapp/app_store/application_files/main_template.yaml @@ -20,7 +20,7 @@ jobs: run: | python ./conda.recipes/getChannels.py > build_command.txt - name: publish-to-conda - uses: romer8/conda-package-publish-action@master + uses: tethysapp/conda-package-publish-action@master with: subDir: 'conda.recipes' AnacondaToken: $${{ secrets.ANACONDA_TOKEN }} From 3e9728da455d58e505a59443527f470a46ae4a95 Mon Sep 17 00:00:00 2001 From: Corey Krewson Date: Wed, 20 Dec 2023 11:08:38 -0600 Subject: [PATCH 3/4] updating clear cache to work with multiple stores --- tethysapp/app_store/resource_helpers.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tethysapp/app_store/resource_helpers.py b/tethysapp/app_store/resource_helpers.py index 852d1ea..53c4ee8 100644 --- a/tethysapp/app_store/resource_helpers.py +++ b/tethysapp/app_store/resource_helpers.py @@ -24,7 +24,14 @@ def clear_cache(data, channel_layer): - cache.delete(CACHE_KEY) + available_stores_data_dict = get_available_stores_values("all") + for store in available_stores_data_dict: + store_name = store['conda_channel'] + for conda_label in store['conda_labels']: + cache_key = f'{store_name}_{conda_label}_app_resources' + cache.delete(cache_key) + + return def create_pre_multiple_stores_labels_obj(app_workspace, refresh=False, stores='all'): @@ -260,7 +267,7 @@ def get_resources_single_store(app_workspace, require_refresh, conda_package,con def fetch_resources_new(app_workspace, refresh=False, conda_package="tethysapp", conda_label="main" , cache_key=None): - + # breakpoint() CHANNEL_NAME = conda_package From 595f06d40b76b322bb375c030c4eee19a107be12 Mon Sep 17 00:00:00 2001 From: Corey Krewson Date: Fri, 22 Dec 2023 12:29:26 -0600 Subject: [PATCH 4/4] cleaned up commented out breakpoints --- tethysapp/app_store/begin_install.py | 5 +-- tethysapp/app_store/controllers.py | 23 +++++++------- tethysapp/app_store/notifications.py | 4 +-- tethysapp/app_store/resource_helpers.py | 37 ++++++---------------- tethysapp/app_store/submission_handlers.py | 18 +---------- tethysapp/app_store/uninstall_handlers.py | 5 --- tethysapp/app_store/update_handlers.py | 2 -- tethysapp/app_store/utilities.py | 1 - 8 files changed, 25 insertions(+), 70 deletions(-) diff --git a/tethysapp/app_store/begin_install.py b/tethysapp/app_store/begin_install.py index 20f9a9b..bb8a7b6 100755 --- a/tethysapp/app_store/begin_install.py +++ b/tethysapp/app_store/begin_install.py @@ -53,7 +53,6 @@ def detect_app_dependencies(app_name, channel_layer, notification_method=send_no # paths = list() # paths = list(filter(lambda x: app_name in x, store_pkg.__path__)) - # breakpoint() paths = list(filter(lambda x: app_name in x, tethysapp.__path__)) @@ -69,7 +68,7 @@ def detect_app_dependencies(app_name, channel_layer, notification_method=send_no if os.path.exists(pip_install_script_path): logger.info("PIP dependencies found. Running Pip install script") - # breakpoint() + notification_method("Running PIP install....", channel_layer) p = subprocess.Popen(['sh', pip_install_script_path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) while True: @@ -123,7 +122,6 @@ def conda_install(app_metadata, app_channel,app_label,app_version, channel_layer # Running the conda install as a subprocess to get more visibility into the running process dir_path = os.path.dirname(os.path.realpath(__file__)) - # breakpoint() script_path = os.path.join(dir_path, "scripts", "conda_install.sh") app_name = app_metadata['name'] + "=" + app_version @@ -171,7 +169,6 @@ def conda_install(app_metadata, app_channel,app_label,app_version, channel_layer def begin_install(installData, channel_layer, app_workspace): # resource = get_resource(installData["name"], app_workspace) - # breakpoint() resource = get_resource_new(installData["name"],installData['channel'],installData['label'], app_workspace) diff --git a/tethysapp/app_store/controllers.py b/tethysapp/app_store/controllers.py index 8326d9a..0e74dc6 100755 --- a/tethysapp/app_store/controllers.py +++ b/tethysapp/app_store/controllers.py @@ -48,7 +48,7 @@ def home(request,app_workspace): app_workspace=True, ) def get_available_stores(request,app_workspace): - # breakpoint() + available_stores_data_dict = app.get_custom_setting("stores_settings") encryption_key = app.get_custom_setting("encryption_key") for store in available_stores_data_dict['stores']: @@ -85,7 +85,7 @@ def generate_empty_multi_store_apps_object(app_list): return return_obj def populate_multi_store_apps_object(stores, multi_store_apps_object): - # breakpoint() + for store in stores: for app in store: for key in app: @@ -102,7 +102,7 @@ def object_to_list(request_obj): def get_multi_store_obj_list(stores): app_list = [] - # breakpoint() + app_list = find_apps_in_stores(stores, app_list) multi_store_apps_object = generate_empty_multi_store_apps_object(app_list) multi_store_apps_object = populate_multi_store_apps_object(stores, multi_store_apps_object) @@ -112,7 +112,7 @@ def get_multi_store_obj_list(stores): def make_single_name(multi_store_apps_object): for key in multi_store_apps_object: - # breakpoint() + for store_name in multi_store_apps_object[key]['name']: multi_store_apps_object[key]['name'] = multi_store_apps_object[key]['name'][store_name] break @@ -129,7 +129,7 @@ def preprocess_single_store(conda_packages,require_refresh,app_workspace): for conda_package in conda_packages: cache_key = f'{conda_package}_app_resources' resources_single_store = get_resources_single_store(app_workspace, require_refresh, conda_package,cache_key) - # breakpoint() + pre_processing_dict['availableApps'].append(resources_single_store['availableApps']) pre_processing_dict['installedApps'].append(resources_single_store['installedApps']) pre_processing_dict['incompatibleApps'].append(resources_single_store['incompatibleApps']) @@ -148,7 +148,7 @@ def get_resources_multiple_stores(request, app_workspace): stores_active = request.GET.get('active_store') require_refresh = request.GET.get('refresh', '') == "true" object_stores_formatted_by_label_and_channel = get_stores_reformatted(app_workspace, refresh=False, stores=stores_active) - # breakpoint() + tethys_version_regex = re.search(r'([\d.]+[\d])', tethys_version).group(1) object_stores_formatted_by_label_and_channel['tethysVersion'] = tethys_version_regex @@ -160,7 +160,7 @@ def get_resources_multiple_stores(request, app_workspace): # 'incompatibleApps': [], # 'tethysVersion': [], # } - # # breakpoint() + # return_object['availableApps'] = get_multi_store_obj_list(pre_processing_dict['availableApps']) # return_object['installedApps'] = get_multi_store_obj_list(pre_processing_dict['installedApps']) # return_object['incompatibleApps'] = get_multi_store_obj_list(pre_processing_dict['incompatibleApps']) @@ -181,7 +181,7 @@ def get_resources_single_store(app_workspace, require_refresh, conda_package,cac else: # tethys_version_regex = '4.0.0' tethys_version_regex = re.search(r'([\d.]+[\d])', tethys_version).group(1) - # breakpoint() + add_compatible = False add_incompatible = False new_compatible_app = copy.deepcopy(resource) @@ -225,7 +225,7 @@ def get_resources_single_store(app_workspace, require_refresh, conda_package,cac app_workspace=True, ) def get_resources(request, app_workspace): - # breakpoint() + conda_package = request.GET.get('conda_channel') require_refresh = request.GET.get('refresh', '') == "true" # Always require refresh @@ -237,14 +237,13 @@ def get_resources(request, app_workspace): available_apps = [] incompatible_apps = [] - # breakpoint() for resource in all_resources: if resource["installed"]: installed_apps.append(resource) else: # tethys_version_regex = '4.0.0' tethys_version_regex = re.search(r'([\d.]+[\d])', tethys_version).group(1) - # breakpoint() + add_compatible = False add_incompatible = False new_compatible_app = copy.deepcopy(resource) @@ -269,7 +268,7 @@ def get_resources(request, app_workspace): # Get any apps installed via GitHub install process github_apps = get_github_install_metadata(app_workspace) - # breakpoint() + context = { 'availableApps': available_apps, 'installedApps': installed_apps + github_apps, diff --git a/tethysapp/app_store/notifications.py b/tethysapp/app_store/notifications.py index 17c265c..4808cb2 100644 --- a/tethysapp/app_store/notifications.py +++ b/tethysapp/app_store/notifications.py @@ -23,7 +23,7 @@ ) class notificationsConsumer(AsyncWebsocketConsumer): async def connect(self): - # breakpoint() + await self.accept() await self.channel_layer.group_add("notifications", self.channel_name) logger.info(f"Added {self.channel_name} channel to notifications") @@ -40,7 +40,7 @@ async def install_notifications(self, event): async def receive(self, text_data): logger.info(f"Received message {text_data} at {self.channel_name}") - # breakpoint() + text_data_json = json.loads(text_data) function_name = text_data_json['type'] module_name = sys.modules[__name__] diff --git a/tethysapp/app_store/resource_helpers.py b/tethysapp/app_store/resource_helpers.py index 53c4ee8..7704d8a 100644 --- a/tethysapp/app_store/resource_helpers.py +++ b/tethysapp/app_store/resource_helpers.py @@ -44,7 +44,7 @@ def create_pre_multiple_stores_labels_obj(app_workspace, refresh=False, stores=' for conda_label in store['conda_labels']: cache_key = f'{store_name}_{conda_label}_app_resources' object_stores[store_name][conda_label] = get_resources_single_store(app_workspace, refresh, store_name,conda_label, cache_key=cache_key) - # breakpoint() + return object_stores def get_new_stores_reformated_by_labels(object_stores): @@ -54,18 +54,17 @@ def get_new_stores_reformated_by_labels(object_stores): list_labels_store = list(object_stores[store].keys()) list_type_apps = list(object_stores[store][list_labels_store[0]].keys()) for type_app in list_type_apps: - # breakpoint() if type_app != 'tethysVersion': new_store_reformatted[store][type_app] = merge_labels_single_store(object_stores[store],store,type_app) return new_store_reformatted def get_stores_reformatted(app_workspace, refresh=False, stores='all'): - # breakpoint() + object_stores_raw = create_pre_multiple_stores_labels_obj(app_workspace, refresh,stores) object_stores_formatted_by_label = get_new_stores_reformated_by_labels(object_stores_raw) ## reformat for stores now object_stores_formatted_by_channel = get_stores_reformated_by_channel(object_stores_formatted_by_label) - # breakpoint() + list_stores_formatted_by_channel = reduce_level_obj(object_stores_formatted_by_channel) return list_stores_formatted_by_channel @@ -123,7 +122,7 @@ def get_app_channel_for_stores(stores): return app_channel_obj def get_app_level_for_store(store,type_apps): - # breakpoint() + apps_levels = {} levels = list(store.keys()) for level in levels: @@ -144,7 +143,7 @@ def merge_levels_for_app_in_store(apps_channels,store,channel,type_apps): for label in store: if label not in apps_channels[app]: - # breakpoint() + continue for key in store[label][type_apps][app]: if key != 'name': @@ -156,7 +155,6 @@ def merge_levels_for_app_in_store(apps_channels,store,channel,type_apps): for label_app in store[label][type_apps][app][key][channel]: new_store_label_obj[app][key][channel][label_app] = store[label][type_apps][app][key][channel][label_app] # except TypeError: - # breakpoint() # x = "hi error" return new_store_label_obj @@ -180,10 +178,7 @@ def merge_labels_for_app_in_store(apps_label,store,channel,type_apps): if app not in new_store_label_obj: new_store_label_obj[app] = {} for label in store: - # if len(apps_label[app]) > 1: - # breakpoint() if label not in apps_label[app]: - # breakpoint() continue for key in store[label][type_apps][app]: if key != 'name': @@ -197,12 +192,11 @@ def merge_labels_for_app_in_store(apps_label,store,channel,type_apps): else: new_store_label_obj[app][key] = store[label][type_apps][app][key] # except TypeError: - # breakpoint() # x = "hi error" return new_store_label_obj def merge_labels_single_store(store,channel,type_apps): - # breakpoint() + apps_labels = get_app_label_obj_for_store(store,type_apps) merged_label_store = merge_labels_for_app_in_store(apps_labels,store,channel,type_apps) return merged_label_store @@ -220,7 +214,7 @@ def get_resources_single_store(app_workspace, require_refresh, conda_package,con # else: # tethys_version_regex = '4.0.0' tethys_version_regex = re.search(r'([\d.]+[\d])', tethys_version).group(1) - # breakpoint() + add_compatible = False add_incompatible = False new_compatible_app = copy.deepcopy(resource) @@ -229,7 +223,6 @@ def get_resources_single_store(app_workspace, require_refresh, conda_package,con for version in resource['versions'][conda_package][conda_label]: # debugging # if resource['name'] == 'test1app' and conda_label == 'dev': - # breakpoint() # x = 'hola' # Assume if not found, that it is compatible with Tethys Platform 3.4.4 @@ -246,7 +239,6 @@ def get_resources_single_store(app_workspace, require_refresh, conda_package,con if add_compatible: available_apps[resource['name']] = new_compatible_app if add_incompatible: - # breakpoint() incompatible_apps[resource['name']] = new_incompatible_app # Get any apps installed via GitHub install process @@ -268,7 +260,6 @@ def get_resources_single_store(app_workspace, require_refresh, conda_package,con def fetch_resources_new(app_workspace, refresh=False, conda_package="tethysapp", conda_label="main" , cache_key=None): - # breakpoint() CHANNEL_NAME = conda_package if conda_label != 'main': @@ -347,7 +338,7 @@ def fetch_resources_new(app_workspace, refresh=False, conda_package="tethysapp", } } - # breakpoint() + if "license" in conda_search_result[app_package][-1]: newPackage["license"][conda_package][conda_label] = conda_search_result[app_package][-1]["license"] @@ -363,13 +354,10 @@ def fetch_resources_new(app_workspace, refresh=False, conda_package="tethysapp", newPackage.get("versionURLs").get(f"{conda_package}").get(f"{conda_label}").append(conda_version.get('url')) newPackage.get("licenses").get(f"{conda_package}").get(f"{conda_label}").append(conda_version.get('license')) - # breakpoint() - if "license" in conda_version: try: license_json = json.loads(conda_version['license'].replace("', '", '", "').replace("': '", '": "').replace("'}", '"}').replace("{'", '{"')) if 'tethys_version' in license_json: - # breakpoint() newPackage["compatibility"][conda_package][conda_label][conda_version.get('version')] = license_json.get('tethys_version') # newPackage.get("compatibility").get(f"{conda_package}").get(f"{conda_label}").append(conda_version.get('license')) except (ValueError, TypeError): @@ -379,7 +367,7 @@ def fetch_resources_new(app_workspace, refresh=False, conda_package="tethysapp", resource_metadata = process_resources_new(resource_metadata, app_workspace, conda_package, conda_label) - # breakpoint() + cache.set(CACHE_KEY, resource_metadata) return resource_metadata else: @@ -448,7 +436,6 @@ def fetch_resources(app_workspace, refresh=False, conda_package="tethysapp", cac def process_resources_new(resources, app_workspace,conda_channel, conda_label): - # breakpoint() for app in resources: workspace_folder = os.path.join(app_workspace.path, 'apps') if not os.path.exists(workspace_folder): @@ -461,7 +448,7 @@ def process_resources_new(resources, app_workspace,conda_channel, conda_label): } app["latestVersion"][conda_channel][conda_label] = app.get("versions").get(f"{conda_channel}").get(f"{conda_label}")[-1] - # breakpoint() + # Check if latest version is compatible. If not, append an asterisk license = app.get("license").get(f"{conda_channel}").get(f"{conda_label}") comp_dict = None @@ -484,13 +471,10 @@ def process_resources_new(resources, app_workspace,conda_channel, conda_label): # FOR Debugging only. @TODO: Remove if(app['installed']): # app["updateAvailable"][conda_channel][conda_label] = True - # breakpoint() # if app['name'] == 'test1app': - # breakpoint() # print("hola") if 'installedVersion' in app: - # breakpoint() if(app["latestVersion"][conda_channel][conda_label].find("*") == False): if parse_version(app["latestVersion"][conda_channel][conda_label]) > parse_version(app["installedVersion"][conda_channel][conda_label]): app["updateAvailable"] = { @@ -543,7 +527,6 @@ def process_resources_new(resources, app_workspace,conda_channel, conda_label): } app['dev_url'][conda_channel][conda_label] = '' # if "tethys_version" in license_metadata: - # # breakpoint() # app.get("compatibility").get(f"{conda_channel}").get(f"{conda_label}")[license_metadata['version']] = license_metadata['tethys_version'] # noqa: E501 except (ValueError, TypeError): diff --git a/tethysapp/app_store/submission_handlers.py b/tethysapp/app_store/submission_handlers.py index 1b2046c..d16ab83 100644 --- a/tethysapp/app_store/submission_handlers.py +++ b/tethysapp/app_store/submission_handlers.py @@ -470,7 +470,6 @@ def pull_git_repo(github_url,active_store, channel_layer, app_workspace): def apply_setup_template(template_path,setup_path, setup_data): #reading from file1 and writing to file2 - # breakpoint() # open the file using read only mode handle = open(template_path, "r") @@ -525,7 +524,6 @@ def process_branch(install_data, channel_layer): # 1 select the git repo with the path github_dir - # breakpoint() ### get the version from the install.yml # install_yml = os.path.join(install_data['github_dir'], 'install.yml') current_tag_name = '' @@ -547,7 +545,6 @@ def process_branch(install_data, channel_layer): today = time.strftime("%Y_%m_%d") setup_py_data = parse_setup_py(filename) - # breakpoint() current_version = setup_py_data["version"] # current_tag_name = "v" + str(current_version) + "_" + today @@ -579,8 +576,6 @@ def process_branch(install_data, channel_layer): # # tethysapp_remote.pull() # repo.git.merge(install_data['branch']) - # breakpoint() - repo.git.checkout('tethysapp_warehouse_release') @@ -601,7 +596,6 @@ def process_branch(install_data, channel_layer): if os.path.exists(recipe_path): shutil.rmtree(recipe_path) - # breakpoint() os.makedirs(recipe_path) # 7 copy the getChannels.py from the source to the destination, if does not exits @@ -612,7 +606,6 @@ def process_branch(install_data, channel_layer): if not os.path.exists(destination): files_changed = True - # breakpoint() shutil.copyfile(source, destination) source = os.path.join(source_files_path, 'meta_template.yaml') @@ -667,7 +660,6 @@ def process_branch(install_data, channel_layer): setup_py_data['app_package'] = install_yml_file.get('name') metadata_dict = {**setup_py_data, "tethys_version": install_yml_file.get('tethys_version', '<=3.4.4'),"dev_url": f'{install_data["dev_url"]}' } - # breakpoint() template_data = { 'metadataObj': json.dumps(metadata_dict).replace('"', "'") } @@ -677,7 +669,6 @@ def process_branch(install_data, channel_layer): if not os.path.exists(destination): files_changed = True - # breakpoint() shutil.copyfile(source, destination) @@ -766,9 +757,6 @@ def process_branch(install_data, channel_layer): logger.info("Completed Local Debug Processing for Git Repo") return - - - # breakpoint() # Merge the new branch with the release branch # tethys_release_branch = repo.branches['tethysapp_warehouse_release'] # base = repo.merge_base(new_release_branch, tethys_release_branch) @@ -791,7 +779,6 @@ def process_branch(install_data, channel_layer): remote_url = '' if repo_exists(repo_name, organization): # Delete the repo - # breakpoint() # to_delete_repo = organization.get_repo(repo_name) # to_delete_repo.delete() @@ -843,7 +830,6 @@ def process_branch(install_data, channel_layer): repo.git.commit(m=f'tag version {current_tag_name}') # repo.config_writer().set_value('push', 'followTags', 'true').release() - # breakpoint() # update the tethys release branch in remote tethysapp_remote.push('tethysapp_warehouse_release', force=True) @@ -918,7 +904,7 @@ def process_branch(install_data, channel_layer): except AttributeError: logger.info("Unable to obtain Workflow Run") job_url = None - # breakpoint() + get_data_json = { "data": { "githubURL": tethysapp_repo.git_url.replace("git:", "https:"), @@ -940,7 +926,6 @@ def add_and_commit_if_files_changed(repo,files_changed,current_tag_name): repo.git.commit(m=f'tag version {current_tag_name}') # repo.config_writer().set_value('push', 'followTags', 'true').release() - # breakpoint() # update the tethys release branch in remote tethysapp_remote.push('tethysapp_warehouse_release', force=True) @@ -1015,7 +1000,6 @@ def get_workflow_job_url(tethysapp_repo,github_organization,key): except AttributeError: logger.info("Unable to obtain Workflow Run") job_url = None - # breakpoint() get_data_json = { "data": { "githubURL": tethysapp_repo.git_url.replace("git:", "https:"), diff --git a/tethysapp/app_store/uninstall_handlers.py b/tethysapp/app_store/uninstall_handlers.py index f470720..edfe94a 100644 --- a/tethysapp/app_store/uninstall_handlers.py +++ b/tethysapp/app_store/uninstall_handlers.py @@ -75,12 +75,8 @@ def uninstall_app(data, channel_layer, app_workspace): # Running the conda install as a subprocess to get more visibility into the running process dir_path = os.path.dirname(os.path.realpath(__file__)) - # breakpoint() script_path = os.path.join(dir_path, "scripts", "mamba_uninstall.sh") - - # breakpoint() - uninstall_command = [script_path, app_name] # Running this sub process, in case the library isn't installed, triggers a restart. @@ -90,7 +86,6 @@ def uninstall_app(data, channel_layer, app_workspace): while should_not_stop: output = p.stdout.readline() if output.decode('utf-8')== 'Mamba Remove Complete\n': - # breakpoint() break if output: # Checkpoints for the output diff --git a/tethysapp/app_store/update_handlers.py b/tethysapp/app_store/update_handlers.py index 4789493..5f2b647 100644 --- a/tethysapp/app_store/update_handlers.py +++ b/tethysapp/app_store/update_handlers.py @@ -30,12 +30,10 @@ def conda_update(app_name, app_version, app_channel,app_label, channel_layer): script_path = os.path.join(dir_path, "scripts", "mamba_update.sh") app_name_with_version = app_name + "=" + app_version - # breakpoint() label_channel = f'{app_channel}' if app_label != 'main': label_channel = f'{app_channel}/label/{app_label}' - # breakpoint() install_command = [script_path, app_name_with_version, label_channel] # Running this sub process, in case the library isn't installed, triggers a restart. diff --git a/tethysapp/app_store/utilities.py b/tethysapp/app_store/utilities.py index c1d3a23..e805c32 100644 --- a/tethysapp/app_store/utilities.py +++ b/tethysapp/app_store/utilities.py @@ -9,7 +9,6 @@ def decrypt(token: str, key: str) -> str: def get_available_stores_values(active_store): - # breakpoint() available_stores_data_dict = app.get_custom_setting("stores_settings")['stores'] if active_store != 'all': available_stores_data_dict = list(filter(lambda x: x['conda_channel'] == active_store, available_stores_data_dict))