-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
In the context of caching the Job is defined by further information such as inputfiles but also statistics that are relevant for caching. The current implementation provides an extension of the basic Job and implements a CachingJob, see lapis/cachingjob.py.
With further extensions we might face issues by subclassing and specifically by overwriting the run method as it carries relevant logic for the simulation that is currently copied from the core Job:
lapis.caching/lapis/cachingjob.py
Lines 207 to 246 in 8f4f614
| async def run(self, drone: "Drone"): | |
| """ | |
| Handles the job's execution. | |
| The job's runtime is given by max(calculation time, transfer time). | |
| The calculation time is determined by `_calculate`, the transfer time by | |
| `_transfer_inputfiles`. | |
| The job will be executed successfully unless the selected drone does not | |
| provide enough resources, is unavailable or an exception occurs. | |
| :param drone: the drone object the job was allocated to and is executed in | |
| """ | |
| assert drone, "Jobs cannot run without a drone being assigned" | |
| self.drone = drone | |
| self.in_queue_until = time.now | |
| self._success = None | |
| await sampling_required.put(self) | |
| try: | |
| start = time.now | |
| print(start) | |
| async with Scope() as scope: | |
| await instant | |
| scope.do(self._transfer_inputfiles()) | |
| await (time + self._calculation_time) | |
| except CancelTask: | |
| print("CancelTask") | |
| # self.drone = None | |
| self._success = False | |
| # await sampling_required.put(self) | |
| # TODO: in_queue_until is still set | |
| except BaseException: | |
| # self.drone = None | |
| self._success = False | |
| await sampling_required.put(self) | |
| # TODO: in_queue_until is still set | |
| raise | |
| else: | |
| self.walltime = time.now - start | |
| self._success = True | |
| await sampling_required.put(self) |
For future maintainability we should consider a different approach here.
Metadata
Metadata
Assignees
Labels
No labels