https://prefect.io logo
Title
m

Matheus Cruz

06/21/2021, 8:28 PM
Hi everyone! I'm trying to run a flow on an ECS Agent with GitHub Storage and LocalExecutor and I'm getting this error.
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

Kevin Kho

06/21/2021, 8:31 PM
Hi @Matheus Cruz, it looks like it can’t find the Github flow here…are you using GithubStorage or GitStorage?
m

Matheus Cruz

06/21/2021, 8:32 PM
GitHub Storage!
k

Kevin Kho

06/21/2021, 8:34 PM
Can you try doing something like
storage = Github(….)
storage.get_flow("flow_name")
m

Matheus Cruz

06/21/2021, 8:49 PM
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
prefect register -p flows/my_flow.py --project MyProject
k

Kevin Kho

06/21/2021, 8:52 PM
Did you push the flow to Github? Do you see this in the repo when your navigate?
m

Matheus Cruz

06/21/2021, 8:59 PM
Yes for both questions!
k

Kevin Kho

06/21/2021, 9:03 PM
Can you try:
with Flow("flow_name") as flow():
    your_task()

storage.add_flow(flow)
storage.build()
storage.get_flow("flow_name")
m

Matheus Cruz

06/21/2021, 10:15 PM
When I try this, i get it over and over again
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
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

Kevin Kho

06/21/2021, 11:13 PM
Oh sorry, I meant run this instead without registration from your local. Is that what you’re doing?
m

Matheus Cruz

06/22/2021, 11:52 AM
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

Kevin Kho

06/22/2021, 2:26 PM
Could you show me where it lives in Github?
One sec, testing it
m

Matheus Cruz

06/22/2021, 2:37 PM
I created a repo called "GitHub_tests" and inside it a directory called "tests", the flow is inside
k

Kevin Kho

06/22/2021, 2:38 PM
Ok I’ll work on a working example on my side
m

Matheus Cruz

06/22/2021, 2:38 PM
Thanks!
k

Kevin Kho

06/22/2021, 2:40 PM
This is working for me. Did your path start with a “/”?
m

Matheus Cruz

06/22/2021, 3:05 PM
I don't know what happened, but now is working hahaha I run the same script and it worked. Thanks!
k

Kevin Kho

06/22/2021, 3:06 PM
…..😅 Sounds good!