Skip to content

Commit

Permalink
Merge pull request #10 from Aquaveo/firo_updates
Browse files Browse the repository at this point in the history
Stability Updates and a Little Clean Up
  • Loading branch information
romer8 authored Dec 26, 2023
2 parents 7fd7e88 + 595f06d commit 02e911f
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 171 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
2 changes: 1 addition & 1 deletion tethysapp/app_store/application_files/main_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 1 addition & 4 deletions tethysapp/app_store/begin_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__))


Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
25 changes: 11 additions & 14 deletions tethysapp/app_store/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -50,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']:
Expand Down Expand Up @@ -87,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:
Expand All @@ -104,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)
Expand All @@ -114,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
Expand All @@ -131,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'])
Expand All @@ -150,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

Expand All @@ -162,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'])
Expand All @@ -183,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)
Expand Down Expand Up @@ -227,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
Expand All @@ -239,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)
Expand All @@ -271,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,
Expand Down
5 changes: 2 additions & 3 deletions tethysapp/app_store/installation_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tethysapp/app_store/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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__]
Expand Down
Loading

0 comments on commit 02e911f

Please sign in to comment.