16 lines
361 B
Python
16 lines
361 B
Python
from __future__ import annotations
|
|
|
|
import secrets
|
|
from datetime import datetime
|
|
|
|
|
|
def new_task_id(workload: str) -> str:
|
|
ts = datetime.now().strftime("%Y%m%d-%H%M%S")
|
|
suffix = secrets.token_hex(2)
|
|
return f"mvp2-{workload}-{ts}-{suffix}"
|
|
|
|
|
|
def attempt_submission_id(task_id: str, attempt_no: int) -> str:
|
|
return f"{task_id}--a{attempt_no:02d}"
|
|
|