Skip to content

Commit

Permalink
Merge pull request #16758 from assuntad23/16556/time-wf-invoked
Browse files Browse the repository at this point in the history
WF Report Enhancement: Converting ISO to UTC for Invocation Date/Time
  • Loading branch information
dannon authored Oct 20, 2023
2 parents cdcadb1 + a7c111b commit 6954aa1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Markdown/Elements/InvocationTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default {
computed: {
content() {
const invocation = this.invocations[this.args.invocation_id];
return invocation && invocation["create_time"];
return invocation && new Date(invocation["create_time"]).toUTCString();
},
},
};
Expand Down
6 changes: 4 additions & 2 deletions lib/galaxy/managers/markdown_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,9 @@ def handle_generate_time(self, line, generate_time):
pass

def handle_invocation_time(self, line, invocation):
self.ensure_rendering_data_for("invocations", invocation)["create_time"] = invocation.create_time.isoformat()
self.ensure_rendering_data_for("invocations", invocation)["create_time"] = invocation.create_time.strftime(
"%Y-%m-%d, %H:%M:%S"
)

def handle_dataset_type(self, line, hda):
self.extend_history_dataset_rendering_data(hda, "ext", hda.ext, "*Unknown dataset type*")
Expand Down Expand Up @@ -547,7 +549,7 @@ def handle_generate_time(self, line, generate_time):
return (content, True)

def handle_invocation_time(self, line, invocation):
content = literal_via_fence(invocation.create_time.isoformat())
content = literal_via_fence(invocation.create_time.strftime("%Y-%m-%d, %H:%M:%S"))
return (content, True)

def handle_dataset_name(self, line, hda):
Expand Down
7 changes: 5 additions & 2 deletions test/unit/app/managers/test_markdown_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ def test_generate_invocation_time(self):
invocation = self._new_invocation()
self.app.workflow_manager.get_invocation.side_effect = [invocation] # type: ignore[attr-defined,union-attr]
result = self._to_basic(example)
assert f"\n {invocation.create_time.isoformat()}" in result
expectedtime = invocation.create_time.strftime("%Y-%m-%d, %H:%M:%S")
assert f"\n {expectedtime}" in result

def test_job_parameters(self):
job = model.Job()
Expand Down Expand Up @@ -412,7 +413,9 @@ def test_get_invocation_time(self):
result, extra_data = self._ready_export(example)
assert "invocations" in extra_data
assert "create_time" in extra_data["invocations"]["be8be0fd2ce547f6"]
assert extra_data["invocations"]["be8be0fd2ce547f6"]["create_time"] == invocation.create_time.isoformat()
assert extra_data["invocations"]["be8be0fd2ce547f6"]["create_time"] == invocation.create_time.strftime(
"%Y-%m-%d, %H:%M:%S"
)

def _ready_export(self, example):
return ready_galaxy_markdown_for_export(self.trans, example)

0 comments on commit 6954aa1

Please sign in to comment.