Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance concept of extension of job #21

Open
eileen-kuehn opened this issue Dec 10, 2020 · 0 comments
Open

Enhance concept of extension of job #21

eileen-kuehn opened this issue Dec 10, 2020 · 0 comments

Comments

@eileen-kuehn
Copy link
Member

eileen-kuehn commented Dec 10, 2020

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:

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.

@eileen-kuehn eileen-kuehn added this to the Basic functionality milestone Dec 10, 2020
@eileen-kuehn eileen-kuehn removed this from the Basic functionality milestone Jun 22, 2021
@eileen-kuehn eileen-kuehn changed the title Remove reference to job Enhance concept of extension of job Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant