Skip to content
Snippets Groups Projects
Commit e06ff955 authored by Daniel Lyons's avatar Daniel Lyons
Browse files

Renaming to make_condor_jobname

parent 89e4b53e
No related branches found
No related tags found
1 merge request!1081Add a function to the template rendering for creating a Condor job name from an arbitrary string
Pipeline #6844 passed
...@@ -424,6 +424,6 @@ class TestWorkflowService: ...@@ -424,6 +424,6 @@ class TestWorkflowService:
def test_condor_name_utility(): def test_condor_name_utility():
t = WorkflowTemplate() t = WorkflowTemplate()
t.filename = "foo.dag" t.filename = "foo.dag"
t.content = b"{{#make_condor_jobid}}T10t10/J2030+2093.23{{/make_condor_jobid}}" t.content = b"{{#make_condor_jobname}}T10t10/J2030+2093.23{{/make_condor_jobname}}"
file = t.render({}) file = t.render({})
assert file.content == b"T10t10/J2030-2093-23" assert file.content == b"T10t10/J2030-2093-23"
...@@ -119,7 +119,7 @@ class WorkflowTemplate(JSONSerializable): ...@@ -119,7 +119,7 @@ class WorkflowTemplate(JSONSerializable):
:return: an AbstractFile rendered from mustache template :return: an AbstractFile rendered from mustache template
""" """
# add some rendering helpers to the argument # add some rendering helpers to the argument
render_helpers = {"make_condor_jobid": self.make_condor_jobid} render_helpers = {"make_condor_jobname": self.make_condor_jobname}
argument = {**render_helpers, **argument} argument = {**render_helpers, **argument}
# render # render
...@@ -153,7 +153,7 @@ class WorkflowTemplate(JSONSerializable): ...@@ -153,7 +153,7 @@ class WorkflowTemplate(JSONSerializable):
return WorkflowTemplate(json["filename"], json["content"]) return WorkflowTemplate(json["filename"], json["content"])
@staticmethod @staticmethod
def make_condor_jobid(content: str, renderer: Callable[[str], str]): def make_condor_jobname(content: str, renderer: Callable[[str], str]):
# get the rendered content # get the rendered content
rendered = renderer(content) rendered = renderer(content)
return rendered.replace(".", "-").replace("+", "-") return rendered.replace(".", "-").replace("+", "-")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment