https://prefect.io logo
a

Anish Chhaparwal

12/02/2020, 5:27 PM
hey i have a couple of question: is it possible to use cache_for in a ShellTask? How can i pass a parameter to command (f string) of a ShellTask. Eg:
git_clone=ShellTask(log_stderr=True)
with Flow ('QETL') as flow:
git_url = Parameter("git_url",
                  
default="<https://github.com/ieee8023/covid-chestxray-dataset>")
git_clone(command="git clone {url} {target}".format(url=git_url)
flow.run()
z

Zanie

12/02/2020, 7:04 PM
Parameters are not resolved until flow runtime so you can’t format the string there. You’d want to have a task that generates the command you want from the parameter e.g.
make_git_clone_command(git_url)
and pass that to
ShellTask
👍 1
And yes
cache_for
should work for any subclass of
Task
👍 1
5 Views