Giuliano Mega
11/03/2022, 10:29 PMInvalid flow run id. Recieved arguments: ['/usr/local/lib/python3.10/site-packages/prefect/engine.py']
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 1594, in <module>
flow_run_id = UUID(
File "/usr/local/lib/python3.10/uuid.py", line 171, in __init__
raise TypeError('one of the hex, bytes, bytes_le, fields, '
TypeError: one of the hex, bytes, bytes_le, fields, or int arguments must be given
FROM prefecthq/prefect:2.6.5-python3.10
COPY pyproject.toml /opt/prefect
COPY poetry.lock /opt/prefect
RUN pip install poetry
RUN poetry config virtualenvs.create false && poetry install --only main
Mason Menges
11/03/2022, 10:36 PMGiuliano Mega
11/03/2022, 10:37 PMprefecthq/prefect:2.6.5-python3.9
Mason Menges
11/03/2022, 10:41 PMGiuliano Mega
11/03/2022, 10:41 PMresource "kubernetes_deployment" "prefect-agent" {
metadata {
name = "prefect-agent"
namespace = "default"
labels = {
app = "prefect-agent"
}
}
spec {
replicas = 1
selector {
match_labels = {
app = "prefect-agent"
}
}
template {
metadata {
labels = {
app = "prefect-agent"
}
}
spec {
container {
name = "agent"
image = "prefecthq/prefect:2.6.5-python3.9"
command = ["prefect", "agent", "start", "-q", "clarity-production"]
image_pull_policy = "IfNotPresent"
env {
name = "PREFECT_API_URL"
value = local.prefect_cloud_api_url
}
env {
name = "PREFECT_API_KEY"
value = data.google_secret_manager_secret_version.prefect-cloud-api-key.secret_data
}
}
}
}
}
}
Mason Menges
11/03/2022, 10:43 PMGiuliano Mega
11/03/2022, 10:45 PMMason Menges
11/03/2022, 11:07 PMGiuliano Mega
11/04/2022, 12:20 AMif __name__ == "__main__":
import os
import sys
try:
flow_run_id = UUID(
sys.argv[1] if len(sys.argv) > 1 else os.environ.get("PREFECT__FLOW_RUN_ID")
)
except Exception:
engine_logger.error(
f"Invalid flow run id. Recieved arguments: {sys.argv}", exc_info=True
)
exit(1)
****** RUNNING COMMAND: python -m prefect.engine *****
Invalid flow run id. Recieved arguments: ['/usr/local/lib/python3.10/site-packages/prefect/engine.py']
Traceback (most recent call last):
Mason Menges
11/04/2022, 12:35 AMGiuliano Mega
11/04/2022, 12:36 AMRyan Peden
11/04/2022, 12:36 AMpython -m
, getting the module location as argv[0] is expected. There's no argv[1] in your args array, but that's not the problemGiuliano Mega
11/04/2022, 12:37 AMRyan Peden
11/04/2022, 12:37 AMPREFECT__FLOW_RUN_ID
isn't presentpython -m prefect.engine
without that env var present, at leastGiuliano Mega
11/04/2022, 12:38 AMRyan Peden
11/04/2022, 12:41 AMKubernetesJob
much, but I wrote another infrastructure block so I'm decently familiar with them. I'm looking through the block's code now to see if I can find where/why this might happenGiuliano Mega
11/04/2022, 12:41 AMcustomizations=[
{
'op': 'add',
'path': '/spec/template/spec/resources',
'value': {
'limits': {
'memory': '1024Mi',
'cpu': '500m'
}
}
},
{
'op': 'add',
'path': '/spec/template/spec/containers/0/env',
'value': [
{
'name': 'ENV',
'value': 'prod'
},
{
'name': 'COLLECTIONS_PREFIX',
'value': ''
},
{
'name': 'PROJECT_ID',
'value': 'window-finance-production'
}
]
},
{
'op': 'add',
'path': '/spec/template/backoffLimit',
'value': 3
}
]
Ryan Peden
11/04/2022, 12:43 AMKubernetesJob
has an extra env
attribute where you can put environment variablesGiuliano Mega
11/04/2022, 12:44 AMRyan Peden
11/04/2022, 12:45 AMGiuliano Mega
11/04/2022, 12:46 AMMason Menges
11/04/2022, 12:56 AMRyan Peden
11/04/2022, 12:57 AM