diff options
Diffstat (limited to 'buildstream/_scheduler/jobs')
-rw-r--r-- | buildstream/_scheduler/jobs/cachesizejob.py | 4 | ||||
-rw-r--r-- | buildstream/_scheduler/jobs/cleanupjob.py | 6 | ||||
-rw-r--r-- | buildstream/_scheduler/jobs/job.py | 25 |
3 files changed, 8 insertions, 27 deletions
diff --git a/buildstream/_scheduler/jobs/cachesizejob.py b/buildstream/_scheduler/jobs/cachesizejob.py index 6e4698af9..a96b92353 100644 --- a/buildstream/_scheduler/jobs/cachesizejob.py +++ b/buildstream/_scheduler/jobs/cachesizejob.py @@ -34,8 +34,8 @@ class CacheSizeJob(Job): if status == JobStatus.OK: self._artifacts.set_cache_size(result) - if self._complete_cb: - self._complete_cb(result) + if self._complete_cb: + self._complete_cb(status, result) def child_process_data(self): return {} diff --git a/buildstream/_scheduler/jobs/cleanupjob.py b/buildstream/_scheduler/jobs/cleanupjob.py index e579e9718..b378b3dab 100644 --- a/buildstream/_scheduler/jobs/cleanupjob.py +++ b/buildstream/_scheduler/jobs/cleanupjob.py @@ -20,8 +20,9 @@ from .job import Job, JobStatus class CleanupJob(Job): - def __init__(self, *args, **kwargs): + def __init__(self, *args, complete_cb, **kwargs): super().__init__(*args, **kwargs) + self._complete_cb = complete_cb context = self._scheduler.context self._artifacts = context.artifactcache @@ -32,3 +33,6 @@ class CleanupJob(Job): def parent_complete(self, status, result): if status == JobStatus.OK: self._artifacts.set_cache_size(result) + + if self._complete_cb: + self._complete_cb(status, result) diff --git a/buildstream/_scheduler/jobs/job.py b/buildstream/_scheduler/jobs/job.py index 837469a39..91ed187b0 100644 --- a/buildstream/_scheduler/jobs/job.py +++ b/buildstream/_scheduler/jobs/job.py @@ -85,28 +85,11 @@ class Process(multiprocessing.Process): # action_name (str): The queue action name # logfile (str): A template string that points to the logfile # that should be used - should contain {pid}. -# resources (iter(ResourceType)) - A set of resources this job -# wants to use. -# exclusive_resources (iter(ResourceType)) - A set of resources -# this job wants to use -# exclusively. # max_retries (int): The maximum number of retries # class Job(): - def __init__(self, scheduler, action_name, logfile, *, - resources=None, exclusive_resources=None, max_retries=0): - - if resources is None: - resources = set() - else: - resources = set(resources) - if exclusive_resources is None: - exclusive_resources = set() - else: - exclusive_resources = set(resources) - - assert exclusive_resources <= resources, "All exclusive resources must also be resources!" + def __init__(self, scheduler, action_name, logfile, *, max_retries=0): # # Public members @@ -114,12 +97,6 @@ class Job(): self.action_name = action_name # The action name for the Queue self.child_data = None # Data to be sent to the main process - # The resources this job wants to access - self.resources = resources - # Resources this job needs to access exclusively, i.e., no - # other job should be allowed to access them - self.exclusive_resources = exclusive_resources - # # Private members # |