Skip to content

Commit 41b3eb2

Browse files
fmastedeepfire
authored andcommitted
workbench: optional one tracer per node for the nomad backend
1 parent 1ac2574 commit 41b3eb2

File tree

5 files changed

+161
-76
lines changed

5 files changed

+161
-76
lines changed

nix/workbench/backend/nomad-job.nix

+32-13
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
, ociImages
1111
# Needs unix_http_server.file
1212
, supervisorConf
13+
, oneTracerPerNode ? false
1314
}:
1415

1516
let
@@ -202,6 +203,7 @@ let
202203
SUPERVISORD_URL = container_supervisord_url;
203204
SUPERVISORD_CONFIG = container_supervisord_conf;
204205
SUPERVISORD_LOGLEVEL = container_supervisord_loglevel;
206+
ONE_TRACER_PER_NODE = oneTracerPerNode;
205207
};
206208

207209
# TODO:
@@ -272,7 +274,8 @@ let
272274
change_mode = "noop";
273275
error_on_missing_key = true;
274276
}
275-
# supervisord configuration file.
277+
# supervisord
278+
## supervisord configuration file.
276279
{
277280
env = false;
278281
destination = "${container_supervisord_conf}";
@@ -281,7 +284,8 @@ let
281284
change_mode = "noop";
282285
error_on_missing_key = true;
283286
}
284-
# Generator start.sh script.
287+
# Generator
288+
## Generator start.sh script.
285289
{
286290
env = false;
287291
destination = "${container_statedir}/generator/start.sh";
@@ -290,7 +294,7 @@ let
290294
change_mode = "noop";
291295
error_on_missing_key = true;
292296
}
293-
# Generator configuration file.
297+
## Generator configuration file.
294298
{
295299
env = false;
296300
destination = "${container_statedir}/generator/run-script.json";
@@ -299,8 +303,14 @@ let
299303
change_mode = "noop";
300304
error_on_missing_key = true;
301305
}
302-
/* TODO: Tracer still needs to use volumes because tracer.socket is shared.
303-
# Tracer start.sh script.
306+
]
307+
++
308+
# Tracer
309+
## If using oneTracerPerNode no "tracer volumes" need to be mounted
310+
## (because of no socket sharing between tasks), and tracer files are
311+
## created using templates.
312+
(lib.optionals (profileNix.value.node.tracer && oneTracerPerNode) [
313+
## Tracer start.sh script.
304314
{
305315
env = false;
306316
destination = "${container_statedir}/tracer/start.sh";
@@ -309,21 +319,28 @@ let
309319
change_mode = "noop";
310320
error_on_missing_key = true;
311321
}
312-
# Tracer configuration file.
322+
## Tracer configuration file.
313323
{
314324
env = false;
315325
destination = "${container_statedir}/tracer/config.json";
316326
data = escapeTemplate (lib.generators.toJSON {}
317-
profileNix.tracer-service.config.value);
327+
# TODO / FIXME: Ugly!
328+
# When running locally every tracer has a 127.0.0.1 address
329+
# and EKG and prometheus ports clash!
330+
(builtins.removeAttrs
331+
profileNix.tracer-service.config.value
332+
[ "hasEKG" "hasPrometheus" "hasRTView" ]
333+
)
334+
);
318335
change_mode = "noop";
319336
error_on_missing_key = true;
320337
}
321-
*/
322-
]
338+
])
323339
++
340+
# Nodes
324341
(lib.lists.flatten (lib.mapAttrsToList
325342
(_: nodeSpec: [
326-
# Node start.sh script.
343+
## Node start.sh script.
327344
{
328345
env = false;
329346
destination = "${container_statedir}/${nodeSpec.name}/start.sh";
@@ -332,7 +349,7 @@ let
332349
change_mode = "noop";
333350
error_on_missing_key = true;
334351
}
335-
# Node configuration file.
352+
## Node configuration file.
336353
{
337354
env = false;
338355
destination = "${container_statedir}/${nodeSpec.name}/config.json";
@@ -341,7 +358,7 @@ let
341358
change_mode = "noop";
342359
error_on_missing_key = true;
343360
}
344-
# Node topology file.
361+
## Node topology file.
345362
{
346363
env = false;
347364
destination = "${container_statedir}/${nodeSpec.name}/topology.json";
@@ -438,7 +455,9 @@ let
438455

439456
}));
440457
in lib.listToAttrs (
441-
lib.optionals profileNix.value.node.tracer [
458+
# If not oneTracerPerNode, an individual tracer task is needed (instead
459+
# of running a tracer alongside a node with supervisor)
460+
lib.optionals (profileNix.value.node.tracer && !oneTracerPerNode) [
442461
{name = "tracer"; value = valueF "tracer" [];}
443462
]
444463
++

nix/workbench/backend/nomad.nix

+2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ let
8787
inherit profileNix;
8888
inherit ociImages;
8989
inherit supervisorConf;
90+
# Actually always "false", may evolve to a "cloud" flag!
91+
oneTracerPerNode = false;
9092
};
9193
in pkgs.runCommand "workbench-backend-output-${profileNix.name}-${name}"
9294
({

0 commit comments

Comments
 (0)