Michael Fichtinger
08/04/2021, 8:36 AMKevin Kho
Michael Fichtinger
08/04/2021, 2:31 PMKevin Kho
Michael Fichtinger
08/04/2021, 2:34 PMKevin Kho
Michael Fichtinger
08/04/2021, 2:39 PMNo, I'm not.
Kevin Kho
Michael Fichtinger
08/04/2021, 2:39 PMimport prefect
from prefect.core import Flow
from prefect.storage import GitHub
from prefect.utilities.tasks import task
from prefect.tasks.shell import ShellTask
from prefect.client.secrets import Secret
shell_task = ShellTask(helper_script="cd ~", return_all=True, stream_output=True)
@task()
def print_result(result):
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(result)
with Flow("test flow github") as flow:
content = shell_task(command="echo Test")
print_result(content)
p = Secret('token')
flow.storage = GitHub(
repo="<https://github.com/repo/flows>", # name of repo
path="my_flows/test1_flow.py", # location of flow file in repo
access_token_secret=p.get(), # name of personal access token secret
)
Kevin Kho
access_token_secret="token"
. Prefect will pull the Secret with that name laterMichael Fichtinger
08/04/2021, 2:54 PM