Randy Coburn
12/13/2021, 10:54 AMError: Got unexpected extra arguments (ExecuteRunArgs, instance_ref: {__JSON__BLOB__}
The code that we are running is exactly:
eval '/usr/local/bin/python -m dagster api execute_run {__JSON_BLOB__}'
We use eval because it is being run from a bash script. We are not sure what the "extra arguments" are? If you need more information about this please ask but, any help would be great...jordan
12/13/2021, 3:10 PMdagster
CLI uses under the hood.
Does your Dockerfile also have a CMD
or ENTRYPOINT
specified? See: https://aws.amazon.com/blogs/opensource/demystifying-entrypoint-cmd-docker/Randy Coburn
12/13/2021, 3:14 PMusername, password, database
however we change the names to be service_a_username
, service_b_username
.jordan
12/13/2021, 3:18 PMENTRYPOINT
? I still suspect it has something to do with how ECS is concatenating ENTRYPOINT
and CMD
.Randy Coburn
12/13/2021, 3:18 PM# CMD allows this to be overridden from run launchers or executors that want
# to run other commands against your repository
ENTRYPOINT ["/bin/bash", "/cmd_run.sh"]
CMD [""]
In the cmd_run.sh
#!/bin/bash
if [ ! -z "$(echo -n $@ | base64)" ]; then
# When we have a cmd passed in we will use it.
# We do this by checking if the array of passed in values is more than zero in length
LAUNCH_WITH_CMD=/launch-with-cmd.yaml
echo "Got a CMD passed in."
CMD_SCRIPT="/cmd.sh"
cat << EOF > $CMD_SCRIPT
#!/bin/bash
echo "Starting CMD"
eval '$@'
EOF
/launch -f $LAUNCH_WITH_CMD
else
# Else we will just run the GRPC container.
/launch -f /launch-grpc-code.yaml
fi
jordan
12/13/2021, 3:27 PMRandy Coburn
12/13/2021, 3:32 PMlaunch-with-cmd.yaml
processes:
secret_processes:
- name: SERVICE_A_RDS_CREDENTIALS
command: /aws-secret-reader
arguments:
- -secret
- {{ env "SERVICE_A_RDS_SECRET_HINT" }}
- -upper-case
- -prepend-with
- SERVICE_A_RDS_
- name: SERVICE_B_CREDENTIALS
command: /aws-secret-reader
arguments:
- -secret
- {{ env "SERVICE_B_SECRET_HINT" }}
- -upper-case
- -prepend-with
- SERVICE_B_
main_processes:
- name: CMD
command: /bin/bash
arguments:
- /cmd.sh
launch-grpc-code.yaml
processes:
secret_processes:
- name: SERVICE_A_RDS_CREDENTIALS
command: /aws-secret-reader
arguments:
- -secret
- {{ env "SERVICE_A_RDS_SECRET_HINT" }}
- -upper-case
- -prepend-with
- SERVICE_A_RDS_
- name: SERVICE_B_CREDENTIALS
command: /aws-secret-reader
arguments:
- -secret
- {{ env "SERVICE_B_SECRET_HINT" }}
- -upper-case
- -prepend-with
- SERVICE_B_
main_processes:
- name: DAG_REPO_GRPC
command: /usr/local/bin/dagster
arguments:
- api
- grpc
- -h
- 0.0.0.0
- -p
- 4000
- -f
- /opt/dagster/app/repositories/datalake_repositories.py
jordan
12/13/2021, 3:38 PMRandy Coburn
12/13/2021, 3:46 PMeval '/usr/local/bin/python -m dagster api execute_run {"__class__": "ExecuteRunArgs", "instance_ref": {"__class__": "InstanceRef", "compute_logs_data": {"__class__": "ConfigurableClassData", "class_name": "LocalComputeLogManager", "config_yaml": "base_dir: /home/service_user/.dagster/storage\n", "module_name": "dagster.core.storage.local_compute_log_manager"}, "custom_instance_class_data": null, "event_storage_data": {"__class__": "ConfigurableClassData", "class_name": "PostgresEventLogStorage", "config_yaml": "postgres_db:\n db_name: dagster\n hostname: <http://dagster.xxx.rds.amazonaws.com|dagster.xxx.rds.amazonaws.com>\n password: xxx\n port: 5432\n username: xxx\n", "module_name": "dagster_postgres.event_log"}, "local_artifact_storage_data": {"__class__": "ConfigurableClassData", "class_name": "LocalArtifactStorage", "config_yaml": "base_dir: /home/service_user/.dagster\n", "module_name": "dagster.core.storage.root"}, "run_coordinator_data": {"__class__": "ConfigurableClassData", "class_name": "QueuedRunCoordinator", "config_yaml": "{}\n", "module_name": "dagster.core.run_coordinator"}, "run_launcher_data": {"__class__": "ConfigurableClassData", "class_name": "EcsRunLauncher", "config_yaml": "container_name: dlakepipe-pipeline-code\ntask_definition: arn:aws:ecs:eu-west-1:123:task-definition/dlakepipe-pipeline-code:1\n", "module_name": "dagster_aws.ecs"}, "run_storage_data": {"__class__": "ConfigurableClassData", "class_name": "PostgresRunStorage", "config_yaml": "postgres_db:\n db_name: dagster\n hostname: <http://dagster.xxx.rds.amazonaws.com|dagster.xxx.rds.amazonaws.com>\n password: xxx\n port: 5432\n username: xxx\n", "module_name": "dagster_postgres.run_storage"}, "schedule_storage_data": {"__class__": "ConfigurableClassData", "class_name": "PostgresScheduleStorage", "config_yaml": "postgres_db:\n db_name: dagster\n hostname: <http://dagster.xxx.rds.amazonaws.com|dagster.xxx.rds.amazonaws.com>\n password: xxx\n port: 5432\n username: xxx\n", "module_name": "dagster_postgres.schedule_storage"}, "scheduler_data": {"__class__": "ConfigurableClassData", "class_name": "DagsterDaemonScheduler", "config_yaml": "{}\n", "module_name": "dagster.core.scheduler"}, "settings": {"telemetry": {"enabled": false}}}, "pipeline_origin": {"__class__": "PipelinePythonOrigin", "pipeline_name": "my_job", "repository_origin": {"__class__": "RepositoryPythonOrigin", "code_pointer": {"__class__": "FileCodePointer", "fn_name": "deploy_docker_repository", "python_file": "/opt/dagster/app/repo_test.py", "working_directory": "/opt/dagster/app"}, "container_image": null, "executable_path": "/usr/local/bin/python"}}, "pipeline_run_id": "8b3de847-95ba-4b98-97b5-f35733e18260"}'
After the capture this is what we have. I have removed the username and password stuff. However the JSON is valid. I tried to get eval to use it as to try stop any bash crazy stuff.jordan
12/13/2021, 3:54 PMRandy Coburn
12/13/2021, 3:59 PM$@
which should be the CMDjordan
12/13/2021, 4:11 PMRandy Coburn
02/17/2022, 8:23 AM