Skip to content

Commit 773cd36

Browse files
committed
LIU-456: Fix failing unittests
1 parent d448656 commit 773cd36

File tree

5 files changed

+14
-30
lines changed

5 files changed

+14
-30
lines changed

daliuge-engine/dlg/apps/app_base.py

-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ def addInput(self, inputDrop, back=True):
146146
uid = inputDrop.uid
147147
if uid not in self._inputs:
148148
self._inputs[uid] = inputDrop
149-
self._inputs_names[uid] = inputDrop.name
150149
if back:
151150
inputDrop.addConsumer(self, False)
152151

@@ -167,7 +166,6 @@ def addOutput(self, outputDrop: DataDROP, back=True):
167166
uid = outputDrop.uid
168167
if uid not in self._outputs:
169168
self._outputs[uid] = outputDrop
170-
self._outputs_names[uid] = outputDrop.name
171169

172170
if back:
173171
outputDrop.addProducer(self, False)

daliuge-engine/dlg/apps/bash_shell_app.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,7 @@ def _run_bash(self, inputs, outputs, stdin=None, stdout=subprocess.PIPE):
208208
)
209209

210210
cmd = self.command.strip()
211-
ins = {inputs[k].name:v for k,v in inputs.items()}
212-
outs = {outputs[k].name:v for k,v in outputs.items()}
213-
214-
logger.debug("input names: %s, output names: %s", ins.keys(), outs.keys())
215-
cmd = droputils.replace_placeholders(cmd, ins, outs)
211+
cmd = droputils.replace_placeholders(cmd, inputs, outputs)
216212

217213
reader = get_port_reader_function(self.input_parser)
218214
keyargs, pargs = replace_named_ports(

daliuge-engine/dlg/apps/dockerapp.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -518,16 +518,11 @@ def run(self):
518518
outport_names,
519519
appArgs,
520520
)
521-
# ins = {k:v for item in inport_names for k,v in item.items()}
522-
# outs = {k:v for item in outport_names for k,v in item.items()}
523-
# ins = {ins[k]:v for k,v in iitems}
524-
# outs = {outs[k]:v for k,v in oitems}
525-
ins = {self._inputs[k].name:v for k,v in self._inputs.items()}
526-
outs = {self._outputs[k].name:v for k,v in self._outputs.items()}
521+
527522
# complete command including all additional parameters and optional redirects
528523
if self._command:
529524
cmd = droputils.replace_placeholders(
530-
self._command, ins, outs
525+
self._command, dockerInputs, dockerOutputs
531526
)
532527
for key, value in keyargs.items():
533528
cmd = cmd.replace(f"{{{key}}}", str(value))

daliuge-engine/dlg/drop.py

-4
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,8 @@ def __init__(self, oid, uid, **kwargs):
257257
# library we need to expose a list.
258258
self._consumers_uids = set()
259259
self._consumers = ListAsDict(self._consumers_uids)
260-
self._consumers_names = dict()
261260
self._producers_uids = set()
262261
self._producers = ListAsDict(self._producers_uids)
263-
self._producers_names = dict()
264262

265263
# Set holding the state of the producers that have finished their
266264
# execution. Once all producers have finished, this DROP moves
@@ -955,7 +953,6 @@ def addConsumer(self, consumer, back=True):
955953
return
956954
# logger.debug("Adding new consumer %r to %r", consumer.oid, self.oid)
957955
self._consumers.append(consumer)
958-
self._consumers_names[consumer.name] = consumer._uid
959956

960957
# Subscribe the consumer to events sent when this DROP moves to
961958
# COMPLETED. This way the consumer will be notified that its input has
@@ -1001,7 +998,6 @@ def addProducer(self, producer, back=True):
1001998
return
1002999

10031000
self._producers.append(producer)
1004-
self._producers_names[producer.name] = producer._uid
10051001

10061002
# Automatic back-reference
10071003
if back and hasattr(producer, "addOutput"):

daliuge-engine/dlg/droputils.py

+11-12
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,14 @@ def has_path(x):
385385

386386
def replace_placeholders(cmd, inputs, outputs):
387387
"""
388-
Replaces any placeholder found in ``cmd`` with the path of the respective
388+
Attemps to replace any placeholder found in ``cmd`` with the path of the respective
389389
input or output Drop from ``inputs`` or ``outputs``.
390-
Placeholders have the different formats:
391390
392-
* ``%iN``, with N starting from 0, indicates the path of the N-th element
393-
from the ``inputs`` argument; likewise for ``%oN``.
394-
* ``%i[X]`` indicates the path of the input with UID ``X``; likewise for
395-
``%o[X]``.
391+
This will attempt to use the value from the associated input or output DROP,
392+
provided it has a `path` attribute.
393+
394+
Sometimes there will be no matching replacement, in which case the argument is not
395+
replaced.
396396
"""
397397

398398
logger.debug(
@@ -413,7 +413,6 @@ def replace_placeholders(cmd, inputs, outputs):
413413
except AttributeError:
414414
logger.debug("Input %s does not have 'dataUrl' attr", attr)
415415

416-
417416
logger.debug("Command after path placeholder replacement is: %s", cmd)
418417

419418
return cmd
@@ -423,12 +422,12 @@ def replace_dataurl_placeholders(cmd, inputs, outputs):
423422
"""
424423
Replaces any placeholder found in ``cmd`` with the dataURL property of the
425424
respective input or output Drop from ``inputs`` or ``outputs``.
426-
Placeholders have the different formats:
427425
428-
* ``%iDataURLN``, with N starting from 0, indicates the path of the N-th
429-
element from the ``inputs`` argument; likewise for ``%oDataURLN``.
430-
* ``%iDataURL[X]`` indicates the path of the input with UID ``X``; likewise
431-
for ``%oDataURL[X]``.
426+
This will attempt to use the value from the reciprocal input or output DROP,
427+
provided it has a `dataURL` attribute.
428+
429+
Sometimes there will be no matching replacement, in which case the argument is not
430+
replaced.
432431
"""
433432

434433
# Inputs/outputs that are not FileDROPs or DirectoryContainers can't

0 commit comments

Comments
 (0)