The example uses a parameter name that is the same as an input Artifact. This approach in inline scripts will generally
cause confusion, but it can be useful for testing the function, as you can pass a value for the Artifact directly to the
function (but you still cannot return a value). The Hera Runner is the more complete and recommended solution.
Anti-Pattern Explanation
Firstly, the name of the Artifact is not programatically linked to the function parameter name. One is a string, while
the other is a variable symbol, changing one (through an IDE refactor) will not affect the other:
fromhera.workflowsimportDAG,Artifact,Workflow,script@script(outputs=Artifact(name="result-art",path="/tmp/result"))defproduce():importpickleresult="foo testing"withopen("/tmp/result","wb")asf:pickle.dump(result,f)@script(inputs=Artifact(name="i",path="/tmp/i"))defconsume(i):# Note that the parameter name is the same as the input Artifact nameimportpicklewithopen("/tmp/i","rb")asf:i=pickle.load(f)print(i)withWorkflow(generate_name="masked-parameter-",entrypoint="d")asw:withDAG(name="d"):p=produce()c=consume(arguments={"i":p.get_artifact("result-art")})p>>c