|
47 | 47 |
|
48 | 48 | _GITHUB_REF_RE: Pattern[str] = re.compile(r"/([^/]+)/data-manager/")
|
49 | 49 |
|
| 50 | +_JOB_KEY_DELIMITER: str = "|" |
| 51 | + |
50 | 52 |
|
51 | 53 | class TextEncoding(enum.Enum):
|
52 | 54 | """A general text encoding format, used initially for Job text fields."""
|
53 | 55 |
|
54 | 56 | JINJA2_3_0 = 1 # Encoding that complies with Jinja2 v3.0.x
|
55 | 57 |
|
56 | 58 |
|
57 |
| -def get_job_key(collection: str, job: str) -> str: |
| 59 | +def get_job_key(*, collection: str, job: str) -> str: |
58 | 60 | """Returns the job Key, a string formed from "<collection>|<job>."""
|
59 |
| - return f"{collection}|{job}" |
| 61 | + return f"{collection}{_JOB_KEY_DELIMITER}{job}" |
| 62 | + |
| 63 | + |
| 64 | +def get_job_from_key(*, key: str) -> Tuple[str, str]: |
| 65 | + """Returns the job Key "<collection>" and "<job>".""" |
| 66 | + parts = key.split(_JOB_KEY_DELIMITER) |
| 67 | + assert len(parts) == 2 |
| 68 | + return parts[0], parts[1] |
60 | 69 |
|
61 | 70 |
|
62 | 71 | def validate_manifest_schema(manifest: Dict[str, Any]) -> Optional[str]:
|
@@ -315,7 +324,7 @@ def get_jobs_replaced(job_definition: Dict[str, Any]) -> Optional[List[str]]:
|
315 | 324 | for replaces in replaces_list:
|
316 | 325 | r_collection: str = replaces["collection"]
|
317 | 326 | r_job: str = replaces["job"]
|
318 |
| - replaced.add(get_job_key(r_collection, r_job)) |
| 327 | + replaced.add(get_job_key(collection=r_collection, job=r_job)) |
319 | 328 | return list(replaced)
|
320 | 329 |
|
321 | 330 |
|
|
0 commit comments