This is an automated email from the ASF dual-hosted git repository. tvb pushed a commit to branch aevri/picklable_jobs in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 23b69c65b4424555194c1c8b18434d2b709ecb3d Author: Angelos Evripiotis <[email protected]> AuthorDate: Thu May 9 10:15:36 2019 +0100 jobs/job: send ChildJob the context, not scheduler Instead of passing the whole scheduler to the ChildJob, only pass the part that is used - the context. Reducing the amount of shared state makes it easier to follow what's going on, and will make it more economical to move to away from the 'fork' model later. --- src/buildstream/_scheduler/jobs/job.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/buildstream/_scheduler/jobs/job.py b/src/buildstream/_scheduler/jobs/job.py index a899b89..6b6f45b 100644 --- a/src/buildstream/_scheduler/jobs/job.py +++ b/src/buildstream/_scheduler/jobs/job.py @@ -130,7 +130,7 @@ class Job(): child_job.setup( self.action_name, - self._scheduler, + self._scheduler.context, self._queue, self._max_retries, self._tries, @@ -508,10 +508,10 @@ class Job(): class ChildJob(): def setup( - self, action_name, scheduler, queue, max_retries, tries, logfile, message_unique_id, task_id): + self, action_name, scheduler_context, queue, max_retries, tries, logfile, message_unique_id, task_id): self.action_name = action_name - self._scheduler = scheduler + self._scheduler_context = scheduler_context self._queue = queue self._max_retries = max_retries self._tries = tries @@ -537,7 +537,7 @@ class ChildJob(): if "unique_id" in kwargs: unique_id = kwargs["unique_id"] del kwargs["unique_id"] - self._scheduler.context.message( + self._scheduler_context.message( Message(unique_id, message_type, message, **kwargs)) # send_message() @@ -606,7 +606,7 @@ class ChildJob(): # Set the global message handler in this child # process to forward messages to the parent process - self._scheduler.context.set_message_handler(self._child_message_handler) + self._scheduler_context.set_message_handler(self._child_message_handler) starttime = datetime.datetime.now() stopped_time = None @@ -623,7 +623,7 @@ class ChildJob(): # Time, log and and run the action function # with _signals.suspendable(stop_time, resume_time), \ - self._scheduler.context.recorded_messages(self._logfile) as filename: + self._scheduler_context.recorded_messages(self._logfile) as filename: self.message(MessageType.START, self.action_name, logfile=filename)
