Tristan Van Berkom pushed to branch tristan/fix-cache-exclusivity at BuildStream / buildstream
Commits:
-
9b327eb6
by Ben Brewer at 2018-09-04T14:41:23Z
-
3e67e64a
by Javier Jardón at 2018-09-04T16:43:13Z
-
3409609e
by Daniel Silverstone at 2018-09-04T16:55:51Z
-
7b32e1ec
by Tristan Maat at 2018-09-04T17:20:55Z
-
470305a7
by Tristan Van Berkom at 2018-09-05T12:02:02Z
-
0b51f1f0
by Tristan Van Berkom at 2018-09-05T12:02:02Z
-
ba89fa8f
by Tristan Van Berkom at 2018-09-05T12:02:02Z
6 changed files:
- buildstream/_scheduler/jobs/job.py
- buildstream/_scheduler/queues/buildqueue.py
- buildstream/_scheduler/queues/pullqueue.py
- buildstream/_scheduler/resources.py
- buildstream/_scheduler/scheduler.py
- doc/source/install_artifacts.rst
Changes:
... | ... | @@ -109,7 +109,7 @@ class Job(): |
109 | 109 |
# Private members
|
110 | 110 |
#
|
111 | 111 |
self._scheduler = scheduler # The scheduler
|
112 |
- self._queue = multiprocessing.Queue() # A message passing queue
|
|
112 |
+ self._queue = None # A message passing queue
|
|
113 | 113 |
self._process = None # The Process object
|
114 | 114 |
self._watcher = None # Child process watcher
|
115 | 115 |
self._listening = False # Whether the parent is currently listening
|
... | ... | @@ -130,6 +130,8 @@ class Job(): |
130 | 130 |
#
|
131 | 131 |
def spawn(self):
|
132 | 132 |
|
133 |
+ self._queue = multiprocessing.Queue()
|
|
134 |
+ |
|
133 | 135 |
self._tries += 1
|
134 | 136 |
self._parent_start_listening()
|
135 | 137 |
|
... | ... | @@ -552,6 +554,9 @@ class Job(): |
552 | 554 |
self.parent_complete(returncode == RC_OK, self._result)
|
553 | 555 |
self._scheduler.job_completed(self, returncode == RC_OK)
|
554 | 556 |
|
557 |
+ # Force the deletion of the queue and process objects to try and clean up FDs
|
|
558 |
+ self._queue = self._process = None
|
|
559 |
+ |
|
555 | 560 |
# _parent_process_envelope()
|
556 | 561 |
#
|
557 | 562 |
# Processes a message Envelope deserialized form the message queue.
|
... | ... | @@ -32,7 +32,7 @@ class BuildQueue(Queue): |
32 | 32 |
|
33 | 33 |
action_name = "Build"
|
34 | 34 |
complete_name = "Built"
|
35 |
- resources = [ResourceType.PROCESS]
|
|
35 |
+ resources = [ResourceType.PROCESS, ResourceType.CACHE]
|
|
36 | 36 |
|
37 | 37 |
def __init__(self, *args, **kwargs):
|
38 | 38 |
super().__init__(*args, **kwargs)
|
... | ... | @@ -29,7 +29,7 @@ class PullQueue(Queue): |
29 | 29 |
|
30 | 30 |
action_name = "Pull"
|
31 | 31 |
complete_name = "Pulled"
|
32 |
- resources = [ResourceType.DOWNLOAD]
|
|
32 |
+ resources = [ResourceType.DOWNLOAD, ResourceType.CACHE]
|
|
33 | 33 |
|
34 | 34 |
def process(self, element):
|
35 | 35 |
# returns whether an artifact was downloaded or not
|
... | ... | @@ -8,7 +8,7 @@ class ResourceType(): |
8 | 8 |
class Resources():
|
9 | 9 |
def __init__(self, num_builders, num_fetchers, num_pushers):
|
10 | 10 |
self._max_resources = {
|
11 |
- ResourceType.CACHE: 1,
|
|
11 |
+ ResourceType.CACHE: 0,
|
|
12 | 12 |
ResourceType.DOWNLOAD: num_fetchers,
|
13 | 13 |
ResourceType.PROCESS: num_builders,
|
14 | 14 |
ResourceType.UPLOAD: num_pushers
|
... | ... | @@ -332,7 +332,6 @@ class Scheduler(): |
332 | 332 |
job = CacheSizeJob(self, 'cache_size', 'cache_size/cache_size',
|
333 | 333 |
resources=[ResourceType.CACHE,
|
334 | 334 |
ResourceType.PROCESS],
|
335 |
- exclusive_resources=[ResourceType.CACHE],
|
|
336 | 335 |
complete_cb=self._run_cleanup)
|
337 | 336 |
self.schedule_jobs([job])
|
338 | 337 |
|
... | ... | @@ -161,13 +161,13 @@ Below are two examples of how to run the cache server as a systemd service, one |
161 | 161 |
|
162 | 162 |
[Service]
|
163 | 163 |
Environment="LC_ALL=C.UTF-8"
|
164 |
- ExecStart=/usr/local/bin/bst-artifact-server --port 11001 --server-key {{certs_path}}/privkey.pem --
|
|
165 |
- server-cert {{certs_path}}/fullchain.pem {{artifacts_path}}
|
|
164 |
+ ExecStart=/usr/local/bin/bst-artifact-server --port 11001 --server-key {{certs_path}}/server.key --server-cert {{certs_path}}/server.crt {{artifacts_path}}
|
|
166 | 165 |
User=artifacts
|
167 | 166 |
|
168 | 167 |
[Install]
|
169 | 168 |
WantedBy=multi-user.target
|
170 | 169 |
|
170 |
+.. code:: ini
|
|
171 | 171 |
|
172 | 172 |
#
|
173 | 173 |
# Pull/Push
|
... | ... | @@ -178,9 +178,7 @@ Below are two examples of how to run the cache server as a systemd service, one |
178 | 178 |
|
179 | 179 |
[Service]
|
180 | 180 |
Environment="LC_ALL=C.UTF-8"
|
181 |
- ExecStart=/usr/local/bin/bst-artifact-server --port 11002 --server-key {{certs_path}}/privkey.pem --
|
|
182 |
- server-cert {{certs_path}}/fullchain.pem --client-certs /home/artifacts/authorized.crt --enable-push /
|
|
183 |
- {{artifacts_path}}
|
|
181 |
+ ExecStart=/usr/local/bin/bst-artifact-server --port 11002 --server-key {{certs_path}}/server.key --server-cert {{certs_path}}/server.crt --client-certs {{certs_path}}/authorized.crt --enable-push {{artifacts_path}}
|
|
184 | 182 |
User=artifacts
|
185 | 183 |
|
186 | 184 |
[Install]
|
... | ... | @@ -188,11 +186,16 @@ Below are two examples of how to run the cache server as a systemd service, one |
188 | 186 |
|
189 | 187 |
Here we define when systemd should start the service, which is after the networking stack has been started, we then define how to run the cache with the desired configuration, under the artifacts user. The {{ }} are there to denote where you should change these files to point to your desired locations.
|
190 | 188 |
|
189 |
+For more information on systemd services see:
|
|
190 |
+`Creating Systemd Service Files <https://www.devdungeon.com/content/creating-systemd-service-files>`_.
|
|
191 |
+ |
|
191 | 192 |
User configuration
|
192 | 193 |
~~~~~~~~~~~~~~~~~~
|
193 | 194 |
The user configuration for artifacts is documented with the rest
|
194 | 195 |
of the :ref:`user configuration documentation <user_config>`.
|
195 | 196 |
|
197 |
+Note that for self-signed certificates, the public key fields are mandatory.
|
|
198 |
+ |
|
196 | 199 |
Assuming you have the same setup used in this document, and that your
|
197 | 200 |
host is reachable on the internet as ``artifacts.com`` (for example),
|
198 | 201 |
then a user can use the following user configuration:
|