summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2020-07-06 18:52:21 +0000
committerBenjamin Schubert <contact@benschubert.me>2020-08-23 16:42:32 +0100
commit433864ddcb0e8bf2d1036da00e3bd0c20463a950 (patch)
tree393d34206f48c28467840524de3f030804ae20b3
parent00c5cd05ec8fe04d72affc42d399ac546d36b5b5 (diff)
downloadbuildstream-bschubert/remove-custom-sched-messages.tar.gz
job.py: Remove ability of job classes to send custom messagesbschubert/remove-custom-sched-messages
We previously were sending custom messages from child jobs to parent jobs for example for reporting the cache size. This is not used anymore by the current implementation. Let's remove this entirely
-rw-r--r--src/buildstream/_scheduler/jobs/job.py43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/buildstream/_scheduler/jobs/job.py b/src/buildstream/_scheduler/jobs/job.py
index 33aeebf29..fd4f7720d 100644
--- a/src/buildstream/_scheduler/jobs/job.py
+++ b/src/buildstream/_scheduler/jobs/job.py
@@ -76,7 +76,6 @@ class _MessageType(FastEnum):
ERROR = 2
RESULT = 3
CHILD_DATA = 4
- SUBCLASS_CUSTOM_MESSAGE = 5
# Job()
@@ -102,11 +101,6 @@ class _MessageType(FastEnum):
# 3. Implement YourJob.create_child_job() and YourJob.parent_complete().
# 4. Implement YourChildJob.child_process().
#
-# A Job instance and its ChildJob share a message pipe. You may send custom
-# messages to the main process using YourChildJob.send_message(). Such messages
-# must be processed in YourJob.handle_message(), which you will also need to
-# override for this purpose.
-#
# Args:
# scheduler (Scheduler): The scheduler
# action_name (str): The queue action name
@@ -332,22 +326,6 @@ class Job:
# Abstract Methods #
#######################################################
- # handle_message()
- #
- # Handle a custom message. This will be called in the main process in
- # response to any messages sent to the main process using the
- # Job.send_message() API from inside a Job.child_process() implementation.
- #
- # There is no need to implement this function if no custom messages are
- # expected.
- #
- # Args:
- # message (any): A simple object (must be pickle-able, i.e. strings,
- # lists, dicts, numbers, but not Element instances).
- #
- def handle_message(self, message):
- raise ImplError("Job '{kind}' does not implement handle_message()".format(kind=type(self).__name__))
-
# parent_complete()
#
# This will be executed in the main process after the job finishes, and is
@@ -483,8 +461,6 @@ class Job:
elif envelope.message_type is _MessageType.CHILD_DATA:
# If we retry a job, we assign a new value to this
self.child_data = envelope.message
- elif envelope.message_type is _MessageType.SUBCLASS_CUSTOM_MESSAGE:
- self.handle_message(envelope.message)
else:
assert False, "Unhandled message type '{}': {}".format(envelope.message_type, envelope.message)
@@ -596,25 +572,6 @@ class ChildJob:
Message(message_type, message, element_name=element_name, element_key=element_key, **kwargs)
)
- # send_message()
- #
- # Send data in a message to the parent Job, running in the main process.
- #
- # This allows for custom inter-process communication between subclasses of
- # Job and ChildJob.
- #
- # These messages will be processed by the Job.handle_message()
- # implementation, which may be overridden to support one or more custom
- # 'message_type's.
- #
- # Args:
- # message_data (any): A simple object (must be pickle-able, i.e.
- # strings, lists, dicts, numbers, but not Element
- # instances). This is sent to the parent Job.
- #
- def send_message(self, message_data):
- self._send_message(_MessageType.SUBCLASS_CUSTOM_MESSAGE, message_data)
-
#######################################################
# Abstract Methods #
#######################################################