Thread
#prefect-community
    n

    Nikola Lusic

    1 year ago
    Hey all, While trying to run a flow via ECS agent, I get the following error:
    Failed to load and execute Flow's environment: StorageError("An error occurred while unpickling the flow:\n TypeError('code() takes at most 15 arguments (16 given)')\n This may be due to one of the following version mismatches between the flow build and execution environments: \n - python: (flow build with '3.8.5', currently running with '3.7.10')")
    I'm running prefect server, prefect agent and registration environment on 3 different Ubuntu machines, all running:
    $ python3
    Python 3.8.5 (default, Jan 27 2021, 15:41:15) 
    [GCC 9.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> import prefect
    >>> prefect.__version__
    '0.14.17'
    >>> sys.version_info
    sys.version_info(major=3, minor=8, micro=5, releaselevel='final', serial=0)
    I don't understand where does the agent pick up the python 3.7.10 version, and why is the task executed with that environment (the python 3.7 is not even installed on the server nor agent environment). Is there a way to set the python version on the execution environment, or am I missing something?
    s

    Spencer

    1 year ago
    What image is the ECS Agent using for the flows (not agent or server, but the flow itself)? That image needs to have the proper python version.
    n

    Nikola Lusic

    1 year ago
    This is the flow I'm trying to test:
    import prefect
    from prefect.storage import S3
    from prefect import task, Flow
    from prefect.run_configs import ECSRun
    
    
    RUN_CONFIG = ECSRun(labels=['ecs-test'])
    STORAGE = S3(bucket='prefect-data')
    
    @task
    def say_hello():
        logger = prefect.context.get("logger")
        <http://logger.info|logger.info>("Hello, ECS!")
    
    with Flow("hello-flow", storage=STORAGE, run_config=RUN_CONFIG) as flow:
        say_hello()
    
    flow.register(project_name="test")
    So, in the
    run_config
    I'm not passing any images. Do you maybe know what image does it default to?
    Kevin Kho

    Kevin Kho

    1 year ago
    Hi @Nikola Lusic! Prefect has default images it will supply. More info here
    n

    Nikola Lusic

    1 year ago
    RTFM, thanks guys, I've overlooked this part. It works like a charm now!
    Kevin Kho

    Kevin Kho

    1 year ago
    No problem! Glad you got it working pretty quickly