summaryrefslogtreecommitdiff
path: root/src/buildstream/_scheduler
diff options
context:
space:
mode:
authorTristan van Berkom <tristan@codethink.co.uk>2020-09-23 12:51:21 +0900
committerTristan van Berkom <tristan@codethink.co.uk>2020-10-27 18:15:50 +0900
commit76773413ec729886ca4cf739f286ed9f4ff416ae (patch)
tree9149328f79969501181e0bac90695ef749f1d587 /src/buildstream/_scheduler
parent7038a505cdfd85a9770329825bb50c184d9ac45f (diff)
downloadbuildstream-76773413ec729886ca4cf739f286ed9f4ff416ae.tar.gz
Adding _DisplayKey type
Instead of passing around untyped tuples for cache keys, lets have a clearly typed object for this. This makes for more readable code, and additionally corrects the data model statement of intent that some cache keys should be displayed as "dim", instead informing the frontend about whether the cache key is "strict" or not, allowing the frontend to decide how to display a strict or non-strict key. This patch does the following: * types.py: Add _DisplayKey * element.py: Return a _DisplayKey from Element._get_display_key() * Other sources: Updated to use the display key object
Diffstat (limited to 'src/buildstream/_scheduler')
-rw-r--r--src/buildstream/_scheduler/jobs/job.py2
-rw-r--r--src/buildstream/_scheduler/queues/queue.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/buildstream/_scheduler/jobs/job.py b/src/buildstream/_scheduler/jobs/job.py
index c8ff853ed..388fe0f5d 100644
--- a/src/buildstream/_scheduler/jobs/job.py
+++ b/src/buildstream/_scheduler/jobs/job.py
@@ -289,7 +289,7 @@ class Job:
# key for for the issuing message (if an element is related to the Job).
#
# Args:
- # element_key (tuple): The element_key tuple to be supplied to the Message() constructor
+ # element_key (_DisplayKey): The element_key tuple to be supplied to the Message() constructor
#
def set_message_element_key(self, element_key):
self._message_element_key = element_key
diff --git a/src/buildstream/_scheduler/queues/queue.py b/src/buildstream/_scheduler/queues/queue.py
index 9e444b393..f5aa2ca4c 100644
--- a/src/buildstream/_scheduler/queues/queue.py
+++ b/src/buildstream/_scheduler/queues/queue.py
@@ -356,9 +356,9 @@ class Queue:
def _element_log_path(self, element):
project = element._get_project()
- key = element._get_display_key()[1]
+ key = element._get_display_key()
action = self.action_name.lower()
- logfile = "{key}-{action}".format(key=key, action=action)
+ logfile = "{key}-{action}".format(key=key.brief, action=action)
return os.path.join(project.name, element.normal_name, logfile)