Hi everyone! I'm trying to run a flow on an ECS Ag...
# prefect-server
m
Hi everyone! I'm trying to run a flow on an ECS Agent with GitHub Storage and LocalExecutor and I'm getting this error.
Copy code
State Message:
Failed to load and execute Flow's environment: UnknownObjectException(404, {'message': 'Not Found', 'documentation_url': '<https://docs.github.com/rest/reference/repos#get-repository-content>'} , {'server': '<http://GitHub.com|GitHub.com>', 'date': 'Mon, 21 Jun 2021 20:19:24 GMT', 'content-type': 'application/json;charset=utf-8', 'transfer -encoding': 'chunked', 'x-oauth-scopes': 'admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications , repo, user, workflow, write:discussion, write:packages', 'x-accepted-oauth-scopes': '', 'x-github-media-type': 'github.v3; format=json', ' x-ratelimit-limit': '5000', 'x-ratelimit-remaining': '4988', 'x-ratelimit-reset': '1624309007', 'x-ratelimit-used': '12', 'x- ratelimit-resource': 'core', 'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X- RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X -Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset', 'access-control-allow-origin': '*', 'strict-transport-security': 'max -age=31536000; includeSubdomains; preload', 'x-frame-options': 'deny', 'x-content-type-options': 'nosniff', 'x-xss-protection': '0',.....
I've tried a lot of things and nothing seems to work, do you know what it can be?
I've already checked the path where the flow script is in github and also the access_token which is in Secrets
k
Hi @Matheus Cruz, it looks like it can’t find the Github flow here…are you using GithubStorage or GitStorage?
m
GitHub Storage!
k
Can you try doing something like
Copy code
storage = Github(….)
storage.get_flow("flow_name")
m
I tried and it gave me an error. "Flow is not contained in this Storage" But I followed the documentation step by step and registered the flow after uploading to the repository with the command
Copy code
prefect register -p flows/my_flow.py --project MyProject
k
Did you push the flow to Github? Do you see this in the repo when your navigate?
m
Yes for both questions!
k
Can you try:
Copy code
with Flow("flow_name") as flow():
    your_task()

storage.add_flow(flow)
storage.build()
storage.get_flow("flow_name")
m
When I try this, i get it over and over again
Copy code
Collecting flows...
[2021-06-21 18:57:11-0300] INFO - prefect.GitHub | Downloading flow from GitHub storage - repo: 'MatheusTulio/GitHub_tests', path: '/ecs_flow_test.py'
[2021-06-21 18:57:12-0300] INFO - prefect.GitHub | Flow successfully downloaded. Using commit: 1d657fd3b0f651bc9264dde5abdf181e9819bd7b
and then
Copy code
File "<string>", line 37, in <module>
  File "/opt/anaconda3/lib/python3.8/site-packages/prefect/storage/github.py", line 128, in get_flow
  return extract_flow_from_file(
  File "/opt/anaconda3/lib/python3.8/site-packages/prefect/utilities/storage.py", line 86, in extract_flow_from_file
  exec(contents, exec_vals)
 RecursionError: maximum recursion depth exceeded during compilation
k
Oh sorry, I meant run this instead without registration from your local. Is that what you’re doing?
m
Yes!
Why can I see the flow in the Prefect Cloud UI and also see the flow being successfully registered in the CLI, but when I try to run storage.flow("flow_name") it gives me an error saying the flow doesn't exist in the storage?
@Kevin Kho
k
Could you show me where it lives in Github?
One sec, testing it
m
I created a repo called "GitHub_tests" and inside it a directory called "tests", the flow is inside
k
Ok I’ll work on a working example on my side
m
Thanks!
k
This is working for me. Did your path start with a “/”?
m
I don't know what happened, but now is working hahaha I run the same script and it worked. Thanks!
k
…..😅 Sounds good!