Thread
#prefect-community
    Joseph Loss

    Joseph Loss

    1 year ago
    Hey all, has anyone had any experience in using Prefect @task decorator in a python package that can be imported and used in flow scripts? The use case here would be a common database connection function, that inside the function would use the Prefect AWS Task to connect and pull credential information from AWS Secrets Manager
    nicholas

    nicholas

    1 year ago
    Hi @Joseph Loss - that should work fine, so long as your package is pip-installable 👍
    Joseph Loss

    Joseph Loss

    1 year ago
    yup! sweet we'll set it up that way! One follow-up question, we have the docker image stored on a private AWS ECR. This seems to stop working after 12 hours of starting the agent, because the authorization token expires and would somehow need to be re-authenticated with aws ecr docker login command in the command line. Otherwise, the docker agent can't pull the latest image on flow run. I've tried passing in the environment variable "PREFECT__CONTEXT__SECRETS__AWS_CREDENTIALS"_ on starting the agent, but that still doesn't seem to solve the issue. Any ideas on how to solve this?
    Kevin Kho

    Kevin Kho

    1 year ago
    I think that might be an ECR setting where you define the expiration time of the tokens that are created (not 100% sure) but that’s where I would look
    Welp looks like there is no way to change the expiration time . I actually don’t know then how to re-authenticate that on a long-running agent.
    I suggest you create a new thread in community so other people will see that 12 hour limit and share how they reauthenticate the agent.
    Joseph Loss

    Joseph Loss

    1 year ago
    On it!