|
21 | 21 | import os |
22 | 22 | import uuid |
23 | 23 | from functools import cmp_to_key |
24 | | -from hashlib import sha256 |
| 24 | +from hashlib import sha1 |
25 | 25 | from pathlib import Path |
26 | 26 |
|
27 | 27 | from cwlgen import CommandLineTool, parse_cwl |
@@ -124,11 +124,12 @@ def _migrate_single_step(client, cmd_line_tool, path, commit=None, parent_commit |
124 | 124 | outputs = list(cmd_line_tool.outputs) |
125 | 125 |
|
126 | 126 | # NOTE: Make run ids deterministic to prevent duplication. |
| 127 | + rel_path = Path(path).relative_to(client.path) |
127 | 128 | if parent_commit: |
128 | | - label = f"{path}@{parent_commit.hexsha}" |
| 129 | + label = f"{rel_path}@{parent_commit.hexsha}" |
129 | 130 | else: |
130 | | - label = f"{path}@{commit.hexsha}" |
131 | | - identifier = sha256(label.encode("utf-8")).hexdigest() |
| 131 | + label = f"{rel_path}@{commit.hexsha}" |
| 132 | + identifier = sha1(label.encode("utf-8")).hexdigest() |
132 | 133 |
|
133 | 134 | base_id = Run.generate_id(client, identifier=identifier) |
134 | 135 | run._id = base_id |
@@ -305,9 +306,9 @@ def _migrate_composite_step(client, workflow, path, commit=None): |
305 | 306 | if not commit: |
306 | 307 | commit = client.find_previous_commit(path) |
307 | 308 | run = Run(client=client, path=path, commit=commit) |
308 | | - |
309 | | - label = f"{path}@{commit.hexsha}" |
310 | | - identifier = sha256(label.encode("utf-8")).hexdigest() |
| 309 | + rel_path = Path(path).relative_to(client.path) |
| 310 | + label = f"{rel_path}@{commit.hexsha}" |
| 311 | + identifier = sha1(label.encode("utf-8")).hexdigest() |
311 | 312 | run._id = Run.generate_id(client, identifier=identifier) |
312 | 313 |
|
313 | 314 | name = "{0}_migrated.yaml".format(uuid.uuid4().hex) |
|
0 commit comments