Skip to content

Commit

Permalink
Remove check for length of pseudo filename.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleGower committed Nov 2, 2023
1 parent 84a8fe0 commit ed1f2a1
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 29 deletions.
1 change: 1 addition & 0 deletions doc/changes/DM-41545.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove error message about too long pseudo filename while preparing workflow as the length is now checked by iDDS.
8 changes: 0 additions & 8 deletions python/lsst/ctrl/bps/panda/cmd_line_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import os
import re

from lsst.ctrl.bps.panda.constants import PANDA_MAX_LEN_INPUT_FILE

_LOG = logging.getLogger(__name__)


Expand Down Expand Up @@ -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
1 change: 0 additions & 1 deletion python/lsst/ctrl/bps/panda/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 2 additions & 8 deletions tests/test_cmd_line_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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__":
Expand Down
13 changes: 1 addition & 12 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ed1f2a1

Please sign in to comment.