From 15ec84ef33743aeec4b7a83c14edf430dc72f420 Mon Sep 17 00:00:00 2001 From: jsheckar <jsheckar@nrao.edu> Date: Wed, 7 Sep 2022 14:34:54 -0600 Subject: [PATCH] Parallelization fixes (WS Side) --- .../1bf29ab04f27_cube_parallelization.py | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 shared/workspaces/alembic/versions/1bf29ab04f27_cube_parallelization.py diff --git a/shared/workspaces/alembic/versions/1bf29ab04f27_cube_parallelization.py b/shared/workspaces/alembic/versions/1bf29ab04f27_cube_parallelization.py new file mode 100644 index 000000000..bcdb11cb6 --- /dev/null +++ b/shared/workspaces/alembic/versions/1bf29ab04f27_cube_parallelization.py @@ -0,0 +1,145 @@ +# Copyright (C) 2021 Associated Universities, Inc. Washington DC, USA. +# +# This file is part of NRAO Workspaces. +# +# Workspaces is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Workspaces is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Workspaces. If not, see <https://www.gnu.org/licenses/>. +"""cube parallelization + +Revision ID: 1bf29ab04f27 +Revises: 85f659bf1425 +Create Date: 2022-09-07 11:54:54.064234 + +""" +import sqlalchemy as sa +from alembic import op + +# revision identifiers, used by Alembic. +revision = "1bf29ab04f27" +down_revision = "85f659bf1425" +branch_labels = None +depends_on = None + +old_envoy_condor = """executable = vlass_coarse_envoy.sh +arguments = metadata.json PPR.xml + +output = vlass_coarse_envoy.out +error = vlass_coarse_envoy.err +log = condor.log + +VLASS_DIR = {{data_location}} +SBIN_PATH = /lustre/aoc/cluster/pipeline/$ENV(CAPO_PROFILE)/workspaces/sbin +should_transfer_files = yes +transfer_input_files = $ENV(HOME)/.ssh/condor_transfer, nraorsync://$(SBIN_PATH)/.matplotlib, nraorsync://$(SBIN_PATH)/pycapo, nraorsync://$(SBIN_PATH)/framework.sh, nraorsync://$(SBIN_PATH)/vela, nraorsync://$(SBIN_PATH)/casa_envoy, nraorsync://$(VLASS_DIR)/working, nraorsync://$(VLASS_DIR)/rawdata, nraorsync://$(VLASS_DIR)/products, nraorsync://$(VLASS_DIR)/{{profile}}.properties, nraorsync://$(VLASS_DIR)/PPR.xml, nraorsync://$(VLASS_DIR)/metadata.json +when_to_transfer_output = ON_EXIT +transfer_output_files = .job.ad ++nrao_output_files = "rawdata working products" +output_destination = nraorsync://$(VLASS_DIR) ++WantIOProxy = True + +request_memory = 50G +request_disk = 850G +getenv = True +environment = "CAPO_PATH=." + +{{#remote}} +requirements = (VLASS == True) ++partition = "VLASS" +Rank = (TARGET.VLASS == True) + (TARGET.VLASSTEST =!= True) +{{/remote}} + +queue + +""" +old_envoy_shell = """#!/bin/sh + +export HOME=$TMPDIR + +set -o errexit + +./casa_envoy --vlass-img $1 $2 +""" + + +new_envoy_condor = """executable = vlass_coarse_envoy.sh +arguments = metadata.json PPR.xml {{requested_parallel}} + +output = vlass_coarse_envoy.out +error = vlass_coarse_envoy.err +log = condor.log + +VLASS_DIR = {{data_location}} +SBIN_PATH = /lustre/aoc/cluster/pipeline/$ENV(CAPO_PROFILE)/workspaces/sbin +should_transfer_files = yes +transfer_input_files = $ENV(HOME)/.ssh/condor_transfer, nraorsync://$(SBIN_PATH)/.matplotlib, nraorsync://$(SBIN_PATH)/pycapo, nraorsync://$(SBIN_PATH)/framework.sh, nraorsync://$(SBIN_PATH)/vela, nraorsync://$(SBIN_PATH)/casa_envoy, nraorsync://$(VLASS_DIR)/working, nraorsync://$(VLASS_DIR)/rawdata, nraorsync://$(VLASS_DIR)/products, nraorsync://$(VLASS_DIR)/{{profile}}.properties, nraorsync://$(VLASS_DIR)/PPR.xml, nraorsync://$(VLASS_DIR)/metadata.json +when_to_transfer_output = ON_EXIT +transfer_output_files = .job.ad ++nrao_output_files = "rawdata working products" +output_destination = nraorsync://$(VLASS_DIR) ++WantIOProxy = True + +request_cpus = {{requested_parallel}} +request_memory = 150G +request_disk = 850G +getenv = True +environment = "CAPO_PATH=." + +{{#remote}} +requirements = (VLASS == True) ++partition = "VLASS" +Rank = (TARGET.VLASS == True) + (TARGET.VLASSTEST =!= True) +{{/remote}} + +queue + +""" +new_envoy_shell = """#!/bin/sh + +export HOME=$TMPDIR + +set -o errexit + +./casa_envoy --vlass-img $1 $2 --parallel $3 +""" + + +def upgrade(): + op.execute( + f""" + UPDATE workflow_templates + SET content=E'{new_envoy_condor}' WHERE filename='vlass_coarse_envoy.condor' + """ + ) + + op.execute( + f""" + UPDATE workflow_templates + SET content=E'{new_envoy_shell}' WHERE filename='vlass_coarse_envoy.sh' + """ + ) + + +def downgrade(): + op.execute( + f""" + UPDATE workflow_templates + SET content=E'{old_envoy_condor}' WHERE filename='vlass_coarse_envoy.condor' + """ + ) + + op.execute( + f""" + UPDATE workflow_templates + SET content=E'{old_envoy_shell}' WHERE filename='vlass_coarse_envoy.sh' + """ + ) -- GitLab