Drew You
04/10/2023, 5:43 PMI'm trying to use an EcsRunLauncher and QueuedRunCoordinator but I keep getting this error:
dagster._check.ParameterCheckError: Param "image" is not a str. Got None which is type <class 'NoneType'>.
File "/usr/local/lib/python3.11/site-packages/dagster/_daemon/run_coordinator/queued_run_coordinator_daemon.py", line 333, in _dequeue_run
instance.run_launcher.launch_run(LaunchRunContext(dagster_run=run, workspace=workspace))
File "/usr/local/lib/python3.11/site-packages/dagster_aws/ecs/launcher.py", line 370, in launch_run
run_task_kwargs = self._run_task_kwargs(run, image, container_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dagster_aws/ecs/launcher.py", line 570, in _run_task_kwargs
task_definition_config = DagsterEcsTaskDefinitionConfig.from_task_definition_dict(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dagster_aws/ecs/tasks.py", line 126, in from_task_definition_dict
return DagsterEcsTaskDefinitionConfig(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dagster_aws/ecs/tasks.py", line 55, in __new__
check.str_param(image, "image"),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dagster/_check/__init__.py", line 1347, in str_param
raise _param_type_mismatch_exception(obj, str, param_name, additional_message)
Drew You
04/10/2023, 5:44 PM# ECS launcher
run_launcher:
module: dagster_aws.ecs
class: EcsRunLauncher
config:
container_name: "syncdag_user_code"
include_sidecars: true
env_vars:
- DAGSTER_POSTGRES_USER
- DAGSTER_POSTGRES_PASSWORD
- DAGSTER_POSTGRES_DB
- PG_DB_CONN_STRING
- SYNCRETIC_ENVIRONMENT
# Custom values via env
run_coordinator:
module: dagster.core.run_coordinator
class: QueuedRunCoordinator
config:
max_concurrent_runs: 25
tag_concurrency_limits:
- key: "database"
value: "redshift"
limit: 4
- key: "dagster/backfill"
limit: 10
Drew You
04/10/2023, 5:45 PMcontainer_name
param, but syncdag_user_code
is the name of the container in the ecs task definition.daniel
04/10/2023, 11:39 PMDrew You
04/11/2023, 2:09 PM[{
"image": "${local.dagster_image_name}",
"name": "${local.dagit_container_name}",
"command": [
"dagit","-h", "0.0.0.0", "-p","8080"
],
"environment": [
${join(",\n", formatlist("{\"name\":\"%s\",\"value\":\"%s\"}", keys(local.dagster_variables), values(local.dagster_variables)))}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "${aws_cloudwatch_log_group.dagster.name}",
"awslogs-region": "${var.aws_region}",
"awslogs-stream-prefix": "dagster"
}
},
"essential": true,
"portMappings": [
{
"containerPort": 8080,
"hostPort": 8080
}
]
},
{
"image": "${local.dagster_image_name}",
"name": "${local.dagster_daemon_container_name}",
"command": [
"dagster-daemon","run"
],
"environment": [
${join(",\n", formatlist("{\"name\":\"%s\",\"value\":\"%s\"}", keys(local.dagster_daemon_variables), values(local.dagster_daemon_variables)))}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "${aws_cloudwatch_log_group.dagster.name}",
"awslogs-region": "${var.aws_region}",
"awslogs-stream-prefix": "dagster"
}
},
"essential": true
},
{
"image": "${local.user_container_image_name}",
"name": "${local.user_container_name}",
"environment": [
${join(",\n", formatlist("{\"name\":\"%s\",\"value\":\"%s\"}", keys(local.dagster_variables), values(local.dagster_variables)))}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "${aws_cloudwatch_log_group.dagster.name}",
"awslogs-region": "${var.aws_region}",
"awslogs-stream-prefix": "dagster"
}
},
"essential": true,
"mountPoints": [
{
"sourceVolume": "${local.dagster_mounted_volume_name}",
"containerPath": "/opt/dagster"
}
],
"portMappings": [
{
"containerPort": 8008,
"hostPort": 8008
}
]
}]
Drew You
04/11/2023, 2:09 PMuser_code
,dagit
, and dagster-daemon
all on the same task definitionDrew You
04/11/2023, 2:10 PMuser_code
into its own task definition, how do you specify the grpc
ip in dagster.yml
?daniel
04/11/2023, 2:19 PMdaniel
04/11/2023, 2:20 PMDrew You
04/11/2023, 4:00 PM{
"image": "${local.user_container_image_name}",
"name": "${local.user_container_name}",
"environment": [
${join(",\n", formatlist("{\"name\":\"%s\",\"value\":\"%s\"}", keys(local.dagster_variables), values(local.dagster_variables)))}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "${aws_cloudwatch_log_group.dagster.name}",
"awslogs-region": "${var.aws_region}",
"awslogs-stream-prefix": "dagster"
}
},
"essential": true,
"mountPoints": [
{
"sourceVolume": "${local.dagster_mounted_volume_name}",
"containerPath": "/opt/dagster"
}
],
"portMappings": [
{
"containerPort": 8008,
"hostPort": 8008
}
]
}
daniel
04/11/2023, 4:00 PMDrew You
04/11/2023, 4:00 PM"mountPoints"
and the "environment"
keysDrew You
04/11/2023, 4:01 PMuser_code
container that has the repo in it, and that seems to not survive the ecs runtaskdaniel
04/11/2023, 4:12 PMDrew You
04/11/2023, 4:40 PMdaniel
04/11/2023, 4:42 PMdaniel
04/11/2023, 4:44 PMdaniel
04/11/2023, 4:45 PMDrew You
04/11/2023, 6:50 PMdaniel
04/11/2023, 6:52 PMdaniel
04/11/2023, 6:53 PMDrew You
04/11/2023, 6:53 PMdaniel
04/11/2023, 6:55 PMDrew You
04/11/2023, 7:02 PMDrew You
04/11/2023, 7:02 PMPG_DB_CONN_STRING : "postgresql://${var.rds_username}:${var.rds_password}@${aws_db_instance.dagster[0].address}:${aws_db_instance.dagster[0].port}/${aws_db_instance.dagster[0].name}",
DAGSTER_POSTGRES_USER: var.rds_username,
DAGSTER_POSTGRES_PASSWORD: var.rds_password,
DAGSTER_POSTGRES_DB: aws_db_instance.dagster[0].name,
DAGSTER_HOME : "${var.dagster-container-home}/",
SYNCDAG_HOME : "/opt/dagster/syncdag/repository.py" #path to a not yet mounted drive
Drew You
04/11/2023, 7:02 PMCMD
arg in the user_code
dockerfile:Drew You
04/11/2023, 7:02 PMCMD env >> /etc/environment && exec poetry run dagster api grpc -h 0.0.0.0 -p 8008 -f $SYNCDAG_HOME
Drew You
04/11/2023, 7:03 PM$SYNCDAG_HOME
does get set correctlydaniel
04/11/2023, 7:06 PMDrew You
04/11/2023, 7:08 PMmountPoints
nor the DAGSTER_
vars. When I set the DAGSTER_
vars in the Dockerfile
, it correctly passes them to the runlauncher and I get the mountPoint
error. It feels like somehow the runlauncher is launching the docker container without the ecs task definitionDrew You
04/11/2023, 7:09 PMDockerfile
itself)daniel
04/11/2023, 7:25 PMDrew You
04/11/2023, 7:30 PM{
"taskDefinitionArn": "",
"containerDefinitions": [
{
"name": "dagit",
"image": "<http://dkr.ecr.us-east-1.amazonaws.com/build_ecs/dagster:devel|dkr.ecr.us-east-1.amazonaws.com/build_ecs/dagster:devel>",
"cpu": 0,
"portMappings": [
{
"containerPort": 8080,
"hostPort": 8080,
"protocol": "tcp"
}
],
"essential": true,
"command": [
"dagit",
"-h",
"0.0.0.0",
"-p",
"8080"
],
"environment": [
{
"name": "DAGSTER_POSTGRES_USER",
"value": "user"
},
{
"name": "SYNCDAG_HOME",
"value": "/opt/dagster/syncdag/repository.py"
},
{
"name": "SYNCRETIC_ENVIRONMENT",
"value": "DEVELOPMENT"
},
{
"name": "DAGSTER_POSTGRES_DB",
"value": "rds"
},
{
"name": "DAGSTER_HOME",
"value": "/opt/dagster/dagster_home//"
},
{
"name": "PG_DB_CONN_STRING",
"value": "user:pass@url/rds"
},
{
"name": "DAGSTER_POSTGRES_PASSWORD",
"value": "password"
}
],
"mountPoints": [],
"volumesFrom": [],
{
"name": "dagster_daemon",
"image": "<http://dkr.ecr.us-east-1.amazonaws.com/build_ecs/dagster:devel|dkr.ecr.us-east-1.amazonaws.com/build_ecs/dagster:devel>",
"cpu": 0,
"portMappings": [],
"essential": true,
"command": [
"dagster-daemon",
"run"
],
"environment": [
{
"name": "PG_DB_CONN_STRING",
"value": "<postgresql://user:pass@url>:port/rds"
},
],
"mountPoints": [],
"volumesFrom": [],
{
"name": "syncdag_user_code",
"image": "<http://dkr.ecr.us-east-1.amazonaws.com/build_ecs/syncdag_user_code:devel|dkr.ecr.us-east-1.amazonaws.com/build_ecs/syncdag_user_code:devel>",
"cpu": 0,
"portMappings": [
{
"containerPort": 8008,
"hostPort": 8008,
"protocol": "tcp"
}
],
"essential": true,
"environment": [
{
"name": "DAGSTER_POSTGRES_USER",
"value": "user"
},
{
"name": "SYNCDAG_HOME",
"value": "/opt/dagster/syncdag/repository.py"
},
{
"name": "DAGSTER_POSTGRES_DB",
"value": "rds"
},
{
"name": "DAGSTER_HOME",
"value": "/opt/dagster/dagster_home//"
},
{
"name": "PG_DB_CONN_STRING",
"value": "user:pass@url/rds"
},
{
"name": "DAGSTER_POSTGRES_PASSWORD",
"value": "password"
}
],
"mountPoints": [
{
"sourceVolume": "dagster",
"containerPath": "/opt/dagster"
}
],
"volumesFrom": [],
],
"revision": 43,
"volumes": [
{
"name": "dagster",
"efsVolumeConfiguration": {
"fileSystemId": "fs-ID",
"rootDirectory": "/",
"transitEncryption": "ENABLED",
"authorizationConfig": {
"accessPointId": "fsap-ID",
"iam": "ENABLED"
}
}
}
],
"status": "ACTIVE",
"
}
Drew You
04/11/2023, 7:30 PMuser_code
container. should I be setting the mount and vars on the dagster_daemon
container?daniel
04/11/2023, 7:30 PMdaniel
04/11/2023, 7:31 PMDrew You
04/11/2023, 7:31 PMdaniel
04/11/2023, 7:32 PMDrew You
04/11/2023, 7:33 PMdagster.yaml
is static and I'd have to figure out a way to set itDrew You
04/11/2023, 7:33 PM0.0.0.0
Drew You
04/11/2023, 7:33 PMgrpc
daniel
04/11/2023, 7:34 PMDrew You
04/12/2023, 4:00 PMRUN poetry config virtualenvs.create false
before RUN poetry install
because the spawned run won't be able to interact w/ poetry (if you're using poetry
)Drew You
04/12/2023, 4:04 PMDrew You
04/12/2023, 4:04 PMFileNotFoundError: [Errno 2] No such file or directory: '/opt/dagster/syncdag/repository.py'
File "/usr/local/lib/python3.11/site-packages/dagster/_grpc/impl.py", line 120, in core_execute_run
recon_pipeline.get_definition()
File "/usr/local/lib/python3.11/site-packages/dagster/_core/definitions/reconstruct.py", line 238, in get_definition
return self.repository.get_definition().get_maybe_subset_job_def(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dagster/_core/definitions/reconstruct.py", line 117, in get_definition
return repository_def_from_pointer(self.pointer, self.repository_load_data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dagster/_core/definitions/reconstruct.py", line 789, in repository_def_from_pointer
target = def_from_pointer(pointer)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dagster/_core/definitions/reconstruct.py", line 679, in def_from_pointer
target = pointer.load_target()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dagster/_core/code_pointer.py", line 175, in load_target
module = load_python_file(self.python_file, self.working_directory)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dagster/_core/code_pointer.py", line 72, in load_python_file
os.stat(python_file)
Drew You
04/12/2023, 4:04 PMDrew You
04/12/2023, 4:05 PMDrew You
04/12/2023, 4:14 PMStaticPartition
s will materialize and the ones w/ no partitions fail w/ that error.daniel
04/12/2023, 4:26 PMDrew You
04/12/2023, 4:42 PMdagit
container instead of the daemon
or user_code
containers.Drew You
04/12/2023, 4:43 PMdaniel
04/12/2023, 4:43 PM