diff --git a/test/integration/dummy_job_resource_parameters.xml b/test/integration/dummy_job_resource_parameters.xml new file mode 100644 index 000000000000..b291f32e1e17 --- /dev/null +++ b/test/integration/dummy_job_resource_parameters.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/test/integration/job_resource_error_recovery_job_conf.yml b/test/integration/job_resource_error_recovery_job_conf.yml new file mode 100644 index 000000000000..e4633099b898 --- /dev/null +++ b/test/integration/job_resource_error_recovery_job_conf.yml @@ -0,0 +1,22 @@ +# job config that fails submission if job resource parameters are requested +runners: + local: + load: galaxy.jobs.runners.local:LocalJobRunner + workers: 1 + dynamic: + rules_module: integration.job_resource_rules + +execution: + default: initial_destination + environments: + initial_destination: + runner: dynamic + type: python + function: local_or_exception + local: + runner: local + +tools: + - class: local + environment: local + resources: upload diff --git a/test/integration/job_resource_rules/__init__.py b/test/integration/job_resource_rules/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/integration/job_resource_rules/fail_if_job_resource_present.py b/test/integration/job_resource_rules/fail_if_job_resource_present.py new file mode 100644 index 000000000000..31497af06bee --- /dev/null +++ b/test/integration/job_resource_rules/fail_if_job_resource_present.py @@ -0,0 +1,5 @@ +def local_or_exception(resource_params): + """Build environment that fails if resource_params are passed.""" + if resource_params: + raise Exception("boo!") + return "local" diff --git a/test/integration/test_job_resource_error_recovery.py b/test/integration/test_job_resource_error_recovery.py new file mode 100644 index 000000000000..836c7641ac02 --- /dev/null +++ b/test/integration/test_job_resource_error_recovery.py @@ -0,0 +1,43 @@ +import os + +from galaxy_test.base.populators import ( + DatasetPopulator, + WorkflowPopulator, +) +from galaxy_test.driver import integration_util + +SCRIPT_DIRECTORY = os.path.abspath(os.path.dirname(__file__)) +JOB_RESOURCES_CONFIG_FILE = os.path.join(SCRIPT_DIRECTORY, "dummy_job_resource_parameters.xml") +JOB_CONFIG = os.path.join(SCRIPT_DIRECTORY, "job_resource_error_recovery_job_conf.yml") + + +class TestJobRecoveryBeforeHandledIntegration(integration_util.IntegrationTestCase): + dataset_populator: DatasetPopulator + framework_tool_and_types = True + + def setUp(self) -> None: + super().setUp() + self.dataset_populator = DatasetPopulator(self.galaxy_interactor) + self.workflow_populator = WorkflowPopulator(self.galaxy_interactor) + + @classmethod + def handle_galaxy_config_kwds(cls, config) -> None: + super().handle_galaxy_config_kwds(config) + config["job_config_file"] = JOB_CONFIG + config["job_resource_params_file"] = JOB_RESOURCES_CONFIG_FILE + + def test_recovers_from_job_resource_errors(self): + with self.dataset_populator.test_history() as history_id: + self.workflow_populator.run_workflow( + """ +class: GalaxyWorkflow +steps: + simple_step: + tool_id: create_2 + tool_state: + __job_resource: + __job_resource__select: 'yes' + cores: '32' +""", + history_id=history_id, + )