Jake Schmidt
01/07/2020, 7:58 PMprefect.Parameter in a call to a prefect.ShellTask? Would I use a StringFormatter task?Zachary Hughes
01/07/2020, 9:25 PMShellTask the same way you would with any other parameter? E.g.:
@task
def print_plus_one(x):
print(x + 1)
with Flow('Parameterized Flow') as flow:
x = Parameter('x', default = 2)
print_plus_one(x=x)Jake Schmidt
01/07/2020, 10:16 PMShellTask needs to run tar -zcvf {output_dir}.tar.gz {output_dir} so I was hoping I could pass a dynamic value to output_dir as a pf.Parameter instead of needing to pass the whole command. Does that make sense?Jeremiah
StringFormatter is the way to go then!Chris White
ShellTask and overriding the run method to only accept a parameter value which then formats the command located at self.command and passes it to super().run(command=command). Let me know if you’d like me to cook up a code example for this