Hello, we’ve recently noticed that the exception l...
# ask-community
t
Hello, we’ve recently noticed that the exception logs in Production are printing out personal home folder path. Do you know how this is happened?
Copy code
@task(log_stdout=True)
def test():
    print(f'current folder: {Path.cwd()}')
    raise Exception('test exception')

Task 'test': Exception encountered during task execution!
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/prefect/engine/task_runner.py", line 863, in get_task_run_state
    logger=self.logger,
  File "/usr/local/lib/python3.7/site-packages/prefect/utilities/executors.py", line 445, in run_task_with_timeout
    return task.run(*args, **kwargs)  # type: ignore
  File "/Users/tonyyun/github/data_operations/dbt_automation/flow.py", line 296, in test
Exception: test exception
, where
/Users/tonyyun/github
shouldn’t be there^
k
Am a bit confused. Isn’t it normal for the Python traceback to contain the line of the file that threw an error? What storage are you using? What is your expectation here?
t
Right that I understand. But the thing is, this flow is deployed to Docker Storage and run by K8s agent, where I didn’t expect any personal stuff referenced there.
k
Gotcha will look into it
Can I see how you defined storage and what image are you using?
t
yeah sure:
Copy code
storage = Docker(
    base_image=PREFECT_IMAGE,
    registry_url="<http://4924xxx.dkr.ecr.us-east-1.amazonaws.com/prefect/|4924xxx.dkr.ecr.us-east-1.amazonaws.com/prefect/>",
)

PREFECT_IMAGE = "prefecthq/prefect:0.15.5-python3.7"
k
Ok will look at how we copy the flow over
🙏 1
This might be related to picking. Two things: 1. If you exec into the container, do you see that directory? 2. You can try
stored_as_script=True
and add the files to the container
a
Agree with Kevin. @Tony Yun I think you could check if the environment from which you register your flow matches the Prefect and Python version used in the base image. If this doesn’t match, then the flow won’t be serialized correctly. And if you want to try Docker storage with
stored_as_script=True
, here is an example: https://github.com/anna-geller/packaging-prefect-flows/blob/master/flows_no_build/docker_script_kubernetes_run_custom_ecr_image.py But note that with
stored_as_script=True
, you need to build the image yourself and push it to ECR before you register and run the flow. Here are commands you can use to do that.
t
Thanks all! I’ll try it out and let you know.