https://prefect.io logo
Title
b

Braun Reyes

12/13/2019, 6:12 AM
I am working on change to the FargateTaskEnvironment to add the ability to manage prefect flow task definitions using task definition revisions instead of just adding a new family everytime. Does anyone on the prefect team know if I can get at the flow_id and version from within the Environment setup code? part of my process involves adding a tag to the task definition that gets created for flow_id and version
c

Chris White

12/13/2019, 6:32 AM
You can with a few minor tweaks; you’ll need to add
flow{id}
to this query: https://github.com/PrefectHQ/prefect/blob/master/src/prefect/cli/execute.py#L44-L51 and then you can access both version and ID via:
flow_run.version
flow_run.flow.id
and then pass this data down to
environment.setup
, either via kwarg or context
b

Braun Reyes

12/13/2019, 1:58 PM
I think flow_run _id and flow_run_version are different then flow_id and version. I accomplished this by adding version to the flow map that the base agent module gets from the api so that I could reference it from the flow_run object passed around in the fargate agent like this: flow_run.flow.version To get these items added to the context in the fargatetaskenvironment in the same way that flow_run_id and flow_run_name are, I added two new context envars to the fargate agent run_task method for flow_id and version I also found and fixed a bug in the fargatetaskenvironment where the cloud auth token does not get passed to the fargate task when the environment is executed by the fargate task that the fargate agent executes.
That’s a whole lot of fargate!
👏 1