Billy McMonagle

    Billy McMonagle

    1 year ago
    Hi there, I'm having some very tricky issues running tasks using
    FargateAgent
    . I am running this agent locally, and it seems to work intermittently. However, I am repeatedly getting this error:
    [2020-10-22 17:59:48,212] INFO - agent | Starting FargateAgent with labels ['XXX']
    [2020-10-22 17:59:48,212] INFO - agent | Agent documentation can be found at <https://docs.prefect.io/orchestration/>
    [2020-10-22 17:59:48,212] INFO - agent | Agent connecting to the Prefect API at <https://api.prefect.io>
    [2020-10-22 17:59:48,269] INFO - agent | Waiting for flow runs...
    [2020-10-22 17:59:48,402] ERROR - agent | [{'path': ['get_runs_in_queue'], 'message': "'NoneType' object has no attribute 'flow_group_id'", 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}]
    My agent code is:
    import os
    from prefect.agent.fargate import FargateAgent
    
    CLUSTER = "XXX"
    SUBNETS = ["subnet-XXX", "subnet-XXX"]
    EXECUTION_ROLE_ARN = "XXX"
    
    agent = FargateAgent(
        labels=["XXX],
        launch_type="FARGATE",
        cluster=CLUSTER,
        executionRoleArn=EXECUTION_ROLE_ARN,
        networkConfiguration={
            "awsvpcConfiguration": {
                "assignPublicIp": "ENABLED",
                "subnets": SUBNETS,
            }
        },
        cpu="256",
        memory="512",
        containerDefinitions=[
            {
                "environment": [{"name": "TEST_ENV", "value": "Success!"}],
                "logConfiguration": {
                    "logDriver": "awslogs",
                    "options": {
                        "awslogs-group": "/my/log/group",
                        "awslogs-region": "us-east-1",
                        "awslogs-stream-prefix": "prefect-flow-runs",
                        "awslogs-create-group": "true",
                    },
                },
            }
        ],
    )
    
    agent.start()
    And flow code is
    from datetime import timedelta
    import prefect
    from prefect import Client, task, Flow
    from prefect.schedules import IntervalSchedule
    
    
    @task
    def hello_task():
        logger = prefect.context.get("logger")
        <http://logger.info|logger.info>("Hello, Cloud!")
    
    
    schedule = IntervalSchedule(interval=timedelta(minutes=1))
    
    with Flow("A New Flow", schedule,) as flow:
        hello_task()
    
    flow.register(project_name="Test Project")
    When I say it's worked intermittently, I mean I've gotten it to launch an actual task in my ECS cluster, but I supplied the wrong
    executionRoleArn
    so it failed. After updating that attribute, it has reverted to the aforementioned error which seems quite unrelated.
    Chris White

    Chris White

    1 year ago
    Hi Billy, the error you’re seeing is definitely unrelated to Fargate; did you by any chance delete any flows recently? Either way, we have a fix for that error specifically that will be rolling out in the next 2 hours, so I’ll let you know when it’s live!
    Billy McMonagle

    Billy McMonagle

    1 year ago
    I did delete flows... I actually used a new flow name so that the flow id wouldn't conflict, but that didn't seem to make a difference. Looking forward to the fix!
    Chris White

    Chris White

    1 year ago
    Hi @Billy McMonagle - the fix has been released; you should no longer see that
    flow_group_id
    error!
    Billy McMonagle

    Billy McMonagle

    1 year ago
    super, thanks @Chris White. I'm certain to have some more interesting issues but making progress 😁