From e40e2a88e5b9d04f0f72df4d23e0f15b1d00d62f Mon Sep 17 00:00:00 2001 From: Liam Huber Date: Wed, 3 Apr 2024 10:44:52 -0700 Subject: [PATCH] Revert save overload (#234) --- pyiron_workflow/job.py | 13 +------------ tests/unit/test_job.py | 32 ++------------------------------ 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/pyiron_workflow/job.py b/pyiron_workflow/job.py index 3a742842..8a220d86 100644 --- a/pyiron_workflow/job.py +++ b/pyiron_workflow/job.py @@ -24,7 +24,7 @@ import os import sys -from pyiron_base import GenericJob, TemplateJob, JOB_CLASS_DICT +from pyiron_base import TemplateJob, JOB_CLASS_DICT from pyiron_base.jobs.flex.pythonfunctioncontainer import ( PythonFunctionContainerJob, get_function_parameter_dict, @@ -122,17 +122,6 @@ def run_static(self): self.to_hdf() self.status.finished = True - def save(self): - # PythonFunctionContainerJob.save assumes that the job is being created - # exclusively from pyiron_base.Project.wrap_python_function, and therefore - # always dynamically renames the job based on the wrapped function and the - # input. - # Here, the jobs are created in the usual way, with the usual use of job name, - # so it is just confusing if this renaming happens; thus, we save as usual. - # If at any point PythonFunctionContainerJob.save behaves in the usual way, - # this override can be removed - GenericJob.save(self) - JOB_CLASS_DICT[NodeOutputJob.__name__] = NodeOutputJob.__module__ diff --git a/tests/unit/test_job.py b/tests/unit/test_job.py index 009275c5..4d5b180b 100644 --- a/tests/unit/test_job.py +++ b/tests/unit/test_job.py @@ -29,39 +29,11 @@ def tearDown(self) -> None: class TestNodeOutputJob(_WithAJob): - def make_a_job_from_node(self, node, job_name=None): - job = self.pr.create.job.NodeOutputJob( - node.label if job_name is None else job_name - ) + def make_a_job_from_node(self, node): + job = self.pr.create.job.NodeOutputJob(node.label) job.input["node"] = node return job - @unittest.skipIf(sys.version_info < (3, 11), "Storage will only work in 3.11+") - def test_job_name_override(self): - job_name = "my_name" - job = self.make_a_job_from_node( - Workflow.create.standard.UserInput(42), - job_name=job_name - ) - self.assertEqual( - job_name, - job.job_name, - msg="Sanity check" - ) - try: - job.save() - self.assertEqual( - job_name, - job.job_name, - msg="Standard behaviour for the parent class is to dynamically rename " - "the job at save time; since we create these jobs as usual from " - "the job creator, this is just confusing and we want to avoid it. " - "If this behaviour is every changed in pyiron_base, the override " - "and this test can both be removed." - ) - finally: - job.remove() - @unittest.skipIf(sys.version_info >= (3, 11), "Storage should only work in 3.11+") def test_clean_failure(self): with self.assertRaises(