Will Milner
12/16/2020, 2:30 PM@task(log_stdout=True)
def sample_print_task():
print("hello")
When I declare a shell task like this
task_shell = ShellTask(return_all=True, log_stdout=True, log_stderr=True, stream_output=True)
with Flow("test") as flow:
print_test = task_shell(command="echo hi", task_args={"name": "hi"})
I don't see anything printed after I register and run the flow. I have log_to_cloud
set to True on the agent I am runningjosh
12/16/2020, 2:33 PMlog_stdout
so you would need to do something like:
@task(log_stdout=True)
def show_output(lines):
print(lines)
# OR
@task
def show_output(lines):
from prefect import context
logger = context.get("logger")
<http://logger.info|logger.info>(lines)
task_shell = ShellTask(return_all=True, log_stderr=True, stream_output=True)
with Flow("test") as flow:
print_test = task_shell(command="echo hi", task_args={"name": "hi"})
show_output(print_test)
Will Milner
12/16/2020, 2:39 PMFailed to write log with error: 413 Client Error: Payload Too Large for url: <http://host.docker.internal:4200/graphql>
josh
12/16/2020, 2:43 PM--env PREFECT__LOGGING__LEVEL=DEBUG
(this will pass the env var to all flow runs it creates) or set it on the single flow’s run config directlyWill Milner
12/16/2020, 2:45 PMPREFECT__LOGGING__LEVEL=DEBUG
and PREFECT__LOGGING_LOG_TO_CLOUD=True
on my agent, still no logs from ShellTasksjosh
12/16/2020, 2:49 PMWill Milner
12/16/2020, 3:16 PM