From c29e44565879fd8b4dfcfeecebf08560ef929b04 Mon Sep 17 00:00:00 2001 From: Jimmy Christensen Date: Tue, 11 Jun 2024 19:25:07 +0200 Subject: [PATCH] Add outputs (#1361) * Add new xml spec with support for layer outputs * Add outputs from xml spec to database * Update VERSION.in Bumped minor version due to spec change * Add python code for adding outputs to layers and bump spec version to 1.14 * Remove debug code and add newline to new spec file --- VERSION.in | 2 +- .../com/imageworks/spcue/LayerDetail.java | 1 + .../spcue/service/JobManagerService.java | 1 + .../com/imageworks/spcue/service/JobSpec.java | 27 +++++ .../main/resources/public/dtd/cjsl-1.14.dtd | 104 ++++++++++++++++++ pyoutline/outline/backend/cue.py | 8 ++ pyoutline/outline/outline.cfg | 2 +- 7 files changed, 143 insertions(+), 2 deletions(-) create mode 100644 cuebot/src/main/resources/public/dtd/cjsl-1.14.dtd diff --git a/VERSION.in b/VERSION.in index e34629406..39010d220 100644 --- a/VERSION.in +++ b/VERSION.in @@ -1 +1 @@ -0.22 +0.23 diff --git a/cuebot/src/main/java/com/imageworks/spcue/LayerDetail.java b/cuebot/src/main/java/com/imageworks/spcue/LayerDetail.java index 565995d9d..575547122 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/LayerDetail.java +++ b/cuebot/src/main/java/com/imageworks/spcue/LayerDetail.java @@ -46,6 +46,7 @@ public class LayerDetail extends LayerEntity implements LayerInterface { public Set tags = new LinkedHashSet(); public Set services = new LinkedHashSet(); public Set limits = new LinkedHashSet(); + public Set outputs = new LinkedHashSet(); /* * diff --git a/cuebot/src/main/java/com/imageworks/spcue/service/JobManagerService.java b/cuebot/src/main/java/com/imageworks/spcue/service/JobManagerService.java index c1ca1bdfc..ad56265d0 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/service/JobManagerService.java +++ b/cuebot/src/main/java/com/imageworks/spcue/service/JobManagerService.java @@ -283,6 +283,7 @@ public JobDetail createJob(BuildableJob buildableJob) { layerDao.insertLayerEnvironment(layer, buildableLayer.env); layer.limits.stream() .forEach(ln -> addLayerLimit(layer, limitDao.findLimit(ln).getLimitId())); + layer.outputs.stream().forEach(ln -> registerLayerOutput(layer, ln)); frameDao.insertFrames(layer, frames); } diff --git a/cuebot/src/main/java/com/imageworks/spcue/service/JobSpec.java b/cuebot/src/main/java/com/imageworks/spcue/service/JobSpec.java index 269a9f4af..6df141c12 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/service/JobSpec.java +++ b/cuebot/src/main/java/com/imageworks/spcue/service/JobSpec.java @@ -752,6 +752,33 @@ private void determineResourceDefaults(Element layerTag, layer.timeout_llu = primaryService.timeout_llu; } + private void determineOutputs(Element layerTag, + BuildableJob job, LayerDetail layer) { + + Element t_outputs = layerTag.getChild("outputs"); + List outputs = new ArrayList(); + /* + * Build a list of outputs from the XML. Filter + * out duplicates and empty outputs. + */ + if (t_outputs != null) { + for (Object tmp : t_outputs.getChildren()) { + Element t_output = (Element) tmp; + String output_path = t_output.getTextTrim(); + + if (output_path.length() == 0) { + continue; + } + + if (outputs.contains(output_path)) { + continue; + } + outputs.add(output_path); + } + } + layer.outputs.addAll(outputs); + } + /** * Converts the job space tagging format into a set of strings. Also * verifies each tag. diff --git a/cuebot/src/main/resources/public/dtd/cjsl-1.14.dtd b/cuebot/src/main/resources/public/dtd/cjsl-1.14.dtd new file mode 100644 index 000000000..8bbcbf6f1 --- /dev/null +++ b/cuebot/src/main/resources/public/dtd/cjsl-1.14.dtd @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pyoutline/outline/backend/cue.py b/pyoutline/outline/backend/cue.py index 8c111a727..1bd34bfb5 100644 --- a/pyoutline/outline/backend/cue.py +++ b/pyoutline/outline/backend/cue.py @@ -394,6 +394,14 @@ def _serialize(launcher, use_pycuerun): except (AttributeError, IndexError): service.text = "default" + if spec_version >= Version("1.14"): + layer_outputs = Et.SubElement(spec_layer, "outputs") + outputs = layer.get_outputs() + for output_name in outputs: + output_path = outputs[output_name] + output = Et.SubElement(layer_outputs, "output", {"name": output_name}) + output.text = output_path.get_path() + build_dependencies(ol, layer, depends) if not layers: diff --git a/pyoutline/outline/outline.cfg b/pyoutline/outline/outline.cfg index 6347825f9..97b7dbba4 100644 --- a/pyoutline/outline/outline.cfg +++ b/pyoutline/outline/outline.cfg @@ -5,7 +5,7 @@ wrapper_dir = %(home)s/wrappers user_dir = bin_dir = %(home)s/bin backend = cue -spec_version = 1.13 +spec_version = 1.14 facility = local domain = example.com maxretries = 2