Hey all, While trying to run a flow via ECS agent...
# ask-community
n
Hey all, While trying to run a flow via ECS agent, I get the following error:
Copy code
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:
Copy code
$ 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
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.
🙌 1
🙏 1
n
This is the flow I'm trying to test:
Copy code
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?
k
Hi @Nikola Lusic! Prefect has default images it will supply. More info here
🙌 1
n
RTFM, thanks guys, I've overlooked this part. It works like a charm now!
k
No problem! Glad you got it working pretty quickly