Ken Nguyen
08/26/2021, 1:46 AMFailed to load and execute Flow's environment: GithubException(404, {'data': 'Not Found'}, {'server': '<http://GitHub.com|GitHub.com>', 'date': 'Thu, 26 Aug 2021 01:20:16 GMT', 'content-type': 'text/plain; charset=utf-8', 'transfer-encoding': 'chunked', 'vary': 'X-PJAX, X-PJAX-Container, Accept-Encoding, Accept, X-Requested-With', 'permissions-policy': 'interest-cohort=()', 'cache-control': 'no-cache', 'set-cookie': 'logged_in=no; domain=.<http://github.com|github.com>; path=/; expires=Fri, 26 Aug 2022 01:20:16 GMT; secure; HttpOnly; SameSite=Lax', 'strict-transport-security': 'max-age=31536000; includeSubdomains; preload', 'x-frame-options': 'deny', 'x-content-type-options': 'nosniff', 'x-xss-protection': '0', 'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin', 'expect-ct': 'max-age=2592000, report-uri="<https://api.github.com/_private/browser/errors>"', 'content-security-policy': "default-src 'none'; base-uri 'self'; connect-src 'self'; form-action 'self'; img-src 'self' data:; script-src 'self'; style-src 'unsafe-inline'", 'content-encoding': 'gzip', 'x-github-request-id': 'EA90:30AB:16BB88:2112BC:6126EC50'})
Ken Nguyen
08/26/2021, 1:47 AMDownloading flow from GitHub storage - repo: '<REPO>', path: '<PATH>'
Kevin Kho
Ken Nguyen
08/26/2021, 1:49 AMSTORAGE = GitHub(repo="<REPO>",
path="<PATH>",
access_token_secret="GITHUB_ACCESS_TOKEN", ,
base_url="<https://github.com/><REPO>.git"
)
...
with Flow("hello-flow", storage=STORAGE) as flow:
say_hello()
Ken Nguyen
08/26/2021, 1:50 AMKevin Kho
base_url
is for if you have you own hosted version of Github hosted somewhere else (not github.com). The default value is https://api.github.com, which is the normal public one. You would have a different API endpoint if your company hosted their own Github.
So I think you can just try removing base_url
and using the default.Ken Nguyen
08/26/2021, 1:57 AMKevin Kho
Ken Nguyen
08/26/2021, 2:04 AMKen Nguyen
08/26/2021, 2:09 AMKevin Kho
Ken Nguyen
08/26/2021, 6:07 AMRUN_CONFIG = ECSRun(labels=['fargate-dev'],
task_role_arn="arn:aws:iam::123456789:role/<ROLE>",
image="org/repo/flows-folder/flow-project-folder")
@task
...
with Flow("hello-flow", run_config=RUN_CONFIG, storage=STORAGE) as flow:
say_hello()
For more context, my GitHub folder structure is below:
org/repo
|_flows-folder
|_flow-project-folder
|_flow.py
|_requirements.txt
|_Dockerfile
(Apologies in advance for any naive questions I have ahead, I'm still a bit new to these tools)Kevin Kho
fargate-dev
as well.Ken Nguyen
08/26/2021, 5:10 PMKevin Kho
Kevin Kho
Ken Nguyen
08/26/2021, 5:14 PMKevin Kho
prefect agent ecs start ……some_configs --label fargate-dev
, and see if this picks up your flow run. If it does, I think the service might not be scaling properly?Ken Nguyen
08/26/2021, 6:06 PM--show-flow-logs
config to the agent. Is there a way for me to 'edit' the agent once it's running (i.e. adding tags/changing configs)?Kevin Kho
Ken Nguyen
08/26/2021, 6:13 PMKevin Kho
Ken Nguyen
08/26/2021, 6:14 PMKevin Kho
Ken Nguyen
08/26/2021, 6:20 PMKevin Kho
Ken Nguyen
08/26/2021, 6:29 PMKen Nguyen
08/27/2021, 12:44 AMimage
argument in ECSRun?Kevin Kho
Kevin Kho
Ken Nguyen
08/27/2021, 1:43 AMKevin Kho
Ken Nguyen
08/27/2021, 2:31 AMKen Nguyen
08/27/2021, 2:42 AMKevin Kho
Git
storage pulls the whole repo, but that’s intended for .sql
or .yaml
files. Not for other python files. The reason is that if you have other Python files, you likely should be making it a Python package and putting that in the Docker. Installing a Python module does stuff with the Python path, so even if Prefect grabbed the repo, it needs to be explicitly installed to be usable. This requires making assumptions about the repo structure that basically felt like re-inventing the wheel of package management.Kevin Kho
Ken Nguyen
08/27/2021, 3:04 AMKevin Kho
Ken Nguyen
08/27/2021, 3:09 AMKevin Kho
Kevin Kho
Ken Nguyen
08/27/2021, 3:21 AMECSRun
if my flow is in GitHub storage and my image is in ECR?Kevin Kho
image
argument here . It’ll look like that. Then you need the agent to have permissions to load that (through aws credentials)Ken Nguyen
08/29/2021, 5:44 AMKevin Kho
Ken Nguyen
08/29/2021, 11:17 PMaws ecs register-task-definition
step, but keep running into this error, could you help me decipher what's wrong?
An error occurred (IncompleteSignatureException) when calling the RegisterTaskDefinition operation: 'key' not a valid key=value pair (missing equal-sign) in Authorization header: 'AWS4-HMAC-SHA256 Credential=<access key id>/20210829/us-east-1/ecs/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=
Ken Nguyen
08/29/2021, 11:19 PM{
"family": "prefect-agent",
"requiresCompatibilities": [
"FARGATE"
],
"networkMode": "awsvpc",
"cpu": "512",
"memory": "1024",
"taskRoleArn": "arn:aws:iam::123123123:role/ECSTaskS3ECRRole",
"executionRoleArn": "arn:aws:iam::123123123:role/ecsTaskExecutionRole",
"containerDefinitions": [
{
"name": "prefect-agent",
"image": "prefecthq/prefect:latest-python3.8",
"essential": true,
"command": [
"prefect",
"agent",
"ecs",
"start"
],
"environment": [
{
"name": "PREFECT__CLOUD__API_KEY",
"value": "<REDACTED>"
},
{
"name": "PREFECT__CLOUD__AGENT__LABELS",
"value": "['fargate','dev']"
},
{
"name": "PREFECT__CLOUD__AGENT__LEVEL",
"value": "INFO"
},
{
"name": "PREFECT__CLOUD__API",
"value": "<https://api.prefect.io>"
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/prefect-agent",
"awslogs-region": "us-west-1",
"awslogs-stream-prefix": "ecs",
"awslogs-create-group": "true"
}
}
}
]
}
Kevin Kho
["prefect","agent","ecs","start", "--key", "INSERT_TOKEN_HERE"]
Ken Nguyen
08/30/2021, 12:31 AMKevin Kho
Ken Nguyen
08/30/2021, 12:35 AMKevin Kho
Ken Nguyen
08/30/2021, 12:38 AMaws ecs register-task-definition --cli-input-json file:///<path>/prefect/prefect-agent-td.json
Kevin Kho
Ken Nguyen
08/30/2021, 12:43 AM{
"family": "prefect-agent",
"requiresCompatibilities": [
"FARGATE"
],
"networkMode": "awsvpc",
"cpu": "512",
"memory": "1024",
"taskRoleArn": "arn:aws:iam::123123123:role/ECSTaskS3ECRRole",
"executionRoleArn": "arn:aws:iam::123123123:role/ecsTaskExecutionRole",
"containerDefinitions": [
{
"name": "prefect-agent",
"image": "prefecthq/prefect:latest-python3.8",
"essential": true,
"command": [
"prefect",
"agent",
"ecs",
"start",
"--key",
"<KEY>"
],
"environment": [
{
"name": "PREFECT__CLOUD__API_KEY",
"value": "<KEY>"
},
{
"name": "PREFECT__CLOUD__AGENT__LABELS",
"value": "['fargate','dev']"
},
{
"name": "PREFECT__CLOUD__AGENT__LEVEL",
"value": "INFO"
},
{
"name": "PREFECT__CLOUD__API",
"value": "<https://api.prefect.io>"
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/prefect-agent",
"awslogs-region": "us-west-1",
"awslogs-stream-prefix": "ecs",
"awslogs-create-group": "true"
}
}
}
]
}
Kevin Kho
Kevin Kho
/
after file
in your CLI command?Kevin Kho
Ken Nguyen
08/30/2021, 1:01 AMKen Nguyen
08/30/2021, 6:21 AMKevin Kho
Ken Nguyen
08/30/2021, 9:07 PMbotocore.exceptions.ClientError: An error occurred (UnauthorizedOperation) when calling the DescribeVpcs operation: You are not authorized to perform this operation.
Would you happen to know which permission policy needs to be added to the IAM user to resolve this?Kevin Kho
DescribeVpcs
listed there, but I don’t know the complete list of permissions because I just test with admin. We might have it somewhere one sec.Kevin Kho
Ken Nguyen
08/30/2021, 9:32 PMKen Nguyen
08/30/2021, 9:33 PMKevin Kho
Ken Nguyen
08/30/2021, 9:35 PMKevin Kho
Ken Nguyen
08/31/2021, 2:23 AMCOPY helper_functions.py /helper_functions.py
in the Dockerfile. Then in my flow file I could do from helper_functions import sample_function
, but I got this error instead: ModuleNotFoundError: No module named
Any suggestions?Kevin Kho
pip install -e .
Kevin Kho
Ken Nguyen
08/31/2021, 2:26 AMKevin Kho
Ken Nguyen
08/31/2021, 2:28 AMKevin Kho
Ken Nguyen
08/31/2021, 2:30 AMKevin Kho
Ken Nguyen
08/31/2021, 6:34 PMimport pandas
. I have that requirement installed in my Docker container which I included in the ECSRun. Yet I still got this error: ModuleNotFoundError: No module named 'pandas'
Is there a specific order I'm supposed write my flow script to prevent this?Kevin Kho
Ken Nguyen
08/31/2021, 6:36 PMKevin Kho
pandas
installed when you register?Ken Nguyen
08/31/2021, 6:39 PMKen Nguyen
08/31/2021, 6:40 PMKevin Kho
Ken Nguyen
08/31/2021, 9:01 PMKevin Kho
Ken Nguyen
08/31/2021, 9:10 PMTypeError: expected string or bytes-like object
errorKen Nguyen
08/31/2021, 9:11 PMKevin Kho
Ken Nguyen
08/31/2021, 9:13 PMKevin Kho
Ken Nguyen
08/31/2021, 9:14 PMKen Nguyen
08/31/2021, 9:21 PMValueError: Local Secret "Name" was not found.
Ken Nguyen
08/31/2021, 9:21 PMKevin Kho
Ken Nguyen
08/31/2021, 11:05 PMKevin Kho
Kevin Kho