From ed1f2a1ecf6a86df39ec3c76c019e07ac5fd1e7d Mon Sep 17 00:00:00 2001 From: Michelle Gower Date: Thu, 2 Nov 2023 20:33:23 +0000 Subject: [PATCH] Remove check for length of pseudo filename. --- doc/changes/DM-41545.misc.rst | 1 + python/lsst/ctrl/bps/panda/cmd_line_embedder.py | 8 -------- python/lsst/ctrl/bps/panda/constants.py | 1 - tests/test_cmd_line_embedder.py | 10 ++-------- tests/test_utils.py | 13 +------------ 5 files changed, 4 insertions(+), 29 deletions(-) create mode 100644 doc/changes/DM-41545.misc.rst diff --git a/doc/changes/DM-41545.misc.rst b/doc/changes/DM-41545.misc.rst new file mode 100644 index 0000000..83acd89 --- /dev/null +++ b/doc/changes/DM-41545.misc.rst @@ -0,0 +1 @@ +Remove error message about too long pseudo filename while preparing workflow as the length is now checked by iDDS. diff --git a/python/lsst/ctrl/bps/panda/cmd_line_embedder.py b/python/lsst/ctrl/bps/panda/cmd_line_embedder.py index 4d6ca0d..07dfa67 100644 --- a/python/lsst/ctrl/bps/panda/cmd_line_embedder.py +++ b/python/lsst/ctrl/bps/panda/cmd_line_embedder.py @@ -29,8 +29,6 @@ import os import re -from lsst.ctrl.bps.panda.constants import PANDA_MAX_LEN_INPUT_FILE - _LOG = logging.getLogger(__name__) @@ -191,10 +189,4 @@ def substitute_command_line(self, cmd_line, lazy_vars, job_name, gwfiles): cmd_line = self.replace_static_files(cmd_line, gwfiles) file_name = job_name + self.attach_pseudo_file_params(actual_lazy_vars) - if len(file_name) > PANDA_MAX_LEN_INPUT_FILE: - _LOG.error(f"Too long pseudo input filename: {file_name}") - raise RuntimeError( - f"job pseudo input file name contains more than {PANDA_MAX_LEN_INPUT_FILE} symbols. Aborting." - ) - return cmd_line, file_name diff --git a/python/lsst/ctrl/bps/panda/constants.py b/python/lsst/ctrl/bps/panda/constants.py index 55cc910..da97649 100644 --- a/python/lsst/ctrl/bps/panda/constants.py +++ b/python/lsst/ctrl/bps/panda/constants.py @@ -39,4 +39,3 @@ PANDA_DEFAULT_CORE_COUNT = 1 PANDA_DEFAULT_CLOUD = "US" PANDA_DEFAULT_MAX_COPY_WORKERS = 10 -PANDA_MAX_LEN_INPUT_FILE = 4000 diff --git a/tests/test_cmd_line_embedder.py b/tests/test_cmd_line_embedder.py index 7bc29a7..5008270 100644 --- a/tests/test_cmd_line_embedder.py +++ b/tests/test_cmd_line_embedder.py @@ -31,7 +31,6 @@ from lsst.ctrl.bps import GenericWorkflowFile from lsst.ctrl.bps.panda.cmd_line_embedder import CommandLineEmbedder -from lsst.ctrl.bps.panda.constants import PANDA_MAX_LEN_INPUT_FILE class TestCmdLineEmbedder(unittest.TestCase): @@ -100,15 +99,10 @@ def testReplaceStaticFilesSome(self): self.assertEqual(orig_cmd_line, orig_cmd_line_copy) self.assertEqual(new_cmd_line, self.ans_cmd_line_2) - def testTooLongPseudoFilename(self): - cmd_line_embedder = CommandLineEmbedder({}) - with self.assertRaises(RuntimeError): - _, _ = cmd_line_embedder.substitute_command_line("", {}, "j" * PANDA_MAX_LEN_INPUT_FILE, []) - def testOKPseudoFilename(self): cmd_line_embedder = CommandLineEmbedder({}) - _, name = cmd_line_embedder.substitute_command_line("", {}, "j" * 15, []) - self.assertIn("j" * 15, name) + _, name = cmd_line_embedder.substitute_command_line("", {}, "j" * 4005, []) + self.assertIn("j" * 4005, name) if __name__ == "__main__": diff --git a/tests/test_utils.py b/tests/test_utils.py index 7f6cc19..81f9ff0 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -30,28 +30,17 @@ import unittest from lsst.ctrl.bps import GenericWorkflowExec, GenericWorkflowJob -from lsst.ctrl.bps.panda.constants import PANDA_MAX_LEN_INPUT_FILE from lsst.ctrl.bps.panda.utils import _make_pseudo_filename class TestPandaUtils(unittest.TestCase): """Simple test of utilities.""" - def testTooLongPseudoFilename(self): - # define enough of a job for this test - myexec = GenericWorkflowExec("test_exec") - myexec.src_uri = "/dummy/path/test_exec" - gwjob = GenericWorkflowJob("j" * PANDA_MAX_LEN_INPUT_FILE) - gwjob.executable = myexec - gwjob.arguments = "" - with self.assertRaises(RuntimeError): - _ = _make_pseudo_filename({}, gwjob) - def testOKPseudoFilename(self): # define enough of a job for this test myexec = GenericWorkflowExec("test_exec") myexec.src_uri = "/dummy/path/test_exec" - gwjob = GenericWorkflowJob("j" * 15) + gwjob = GenericWorkflowJob("j" * 4005) gwjob.executable = myexec gwjob.arguments = "" name = _make_pseudo_filename({}, gwjob)