Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a List of Inputs for Prefect ECS Work Pool Start Commands #17042

Open
skohlleffel opened this issue Feb 7, 2025 · 0 comments
Open

Allow a List of Inputs for Prefect ECS Work Pool Start Commands #17042

skohlleffel opened this issue Feb 7, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@skohlleffel
Copy link

Bug summary

Issue

Currently Prefect doesn't support a list of inputs as a custom start command. This functionality is natively supported by Docker and ECS.

Example

Command: ['/bin/sh', '-c', 'python -m some.module', '&&', 'prefect flow-run execute']
If I pass the above start command list to a Prefect ECS work pool. I get the following error:

Stacktrace:

Failed to submit flow run '89015a3e-c72b-4e8c-af78-c90d7521eea5' to infrastructure.
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/prefect/workers/base.py", line 1007, in _submit_run_and_capture_errors
    configuration = await self._get_configuration(flow_run)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/workers/base.py", line 1105, in _get_configuration
    configuration = await self.job_configuration.from_template_and_values(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect/client/utilities.py", line 99, in with_injected_client
    return await fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/prefect_aws/workers/ecs_worker.py", line 422, in from_template_and_values
    return cls(**populated_configuration)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 214, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for ECSJobConfiguration
command
  Input should be a valid string [type=string_type, input_value=['/bin/sh', '-c', 'python...efect flow-run execute'], input_type=list]
    For further information visit https://errors.pydantic.dev/2.10/v/string_type

I can't pass in the commands as a single string because Docker will only execute the first command in front of the &&. For example, python -m some.module && prefect flow-run execute will result in only python -m some.module being executed.

Version info

Version:             3.1.8
API version:         0.8.4
Python version:      3.11.11
Git commit:          53a83ebc
Built:               Tue, Dec 17, 2024 10:20 AM
OS/Arch:             linux/x86_64
Profile:             ephemeral
Server type:         ephemeral
Pydantic version:    2.9.2
Server:
  Database:          sqlite
  SQLite version:    3.34.1
Integrations:
  prefect-shell:     0.3.0
  prefect-dask:      0.3.2

Additional context

No response

@skohlleffel skohlleffel added the bug Something isn't working label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant