Creates a new job, assigns it a unique ID, and stores it.
(self, path: str, is_dependency: bool = False)
| 73 | self.lock = threading.Lock() # A lock to ensure thread-safe access to the jobs dictionary. |
| 74 | |
| 75 | def create_job(self, path: str, is_dependency: bool = False) -> str: |
| 76 | """Creates a new job, assigns it a unique ID, and stores it.""" |
| 77 | job_id = str(uuid.uuid4()) |
| 78 | with self.lock: |
| 79 | self.jobs[job_id] = JobInfo( |
| 80 | job_id=job_id, |
| 81 | status=JobStatus.PENDING, |
| 82 | start_time=datetime.now(), |
| 83 | path=path, |
| 84 | is_dependency=is_dependency |
| 85 | ) |
| 86 | return job_id |
| 87 | |
| 88 | def update_job(self, job_id: str, **kwargs): |
| 89 | """Updates the information for a specific job in a thread-safe manner.""" |