Hi all, I have written a sample flow which retriev...
# ask-community
l
Hi all, I have written a sample flow which retrieve flow code from github and execute in a docker agent lives on an EC2 instance. From the log, it is showing that code was retrieved correctly from GitHub but failed execution and it was giving a weird error.
Failed to load and execute Flow's environment: NameError("name 'Local' is not defined")
I am not entirely sure where the name normal is from Here is my sample code for reference:
Copy code
from prefect import task, Flow
from prefect.run_configs import DockerRun
from prefect.storage.github import GitHub

@task
def say_hello():
    print("Hello, world!")

with Flow(name="My first flow with Docker agent", storage=GitHub(repo="bbbb/aaaa-bdp", path="/PREFECT/hello_world_github.py", access_token_secret="GIT_ACCESS_TOKEN")) as flow:
    say_hello=say_hello()
flow.run_config=DockerRun(labels=['<http://prefect.aaaa.com|prefect.aaaa.com>'])

#flow.run()
flow.register("first_prefect_project")
j
Hi Liren, that certainly is odd. I'm unable to reproduce this error with your flow as written, is that exactly the code that was executed? And does the file path + commit match the flow code above (meaning are you sure that the flow that was picked up is the flow you've copy-pasted above)?
The commit used is in the logs you've pasted, as is the path.
l
Hi @Jim Crist-Harif, I did blank out the repo path and label name. Since I tried to blank out company specific information. Do you need to actual path info to test execute on your end?
j
No, I'm able to recreate locally with my own paths and labels. What I meant by the above question was: Can you confirm that the commit and path mentioned in the logs you screenshot (commit starts with
619f5440
) actually point to the code you posted above? It might be that the flow that was executed isn't the flow you thought was executed.
l
🙏
that is it! @Jim Crist-Harif
the code in git was not updated
j
Excellent, glad to hear it.