https://dagster.io/ logo
#deployment-ecs
Title
# deployment-ecs
a

ashish meshram

03/22/2023, 1:57 PM
📗 resolved Hey All, we are running Dagster Cloud hybrid setup, when i added sample dagster example from UI using below config
Copy code
location_name: cloud-examples
image: dagster/dagster-cloud-examples
code_source:
  package_name: dagster_cloud_examples
I launched the job and it run fine and provided me the results, however the task is till there and consuming resources on AWS. I understand that Agent needs to run all the time however, code location specific ecs service/task should only be triggered when we push run or scheduler runs it. is the functionality or am i missing something ?
d

daniel

03/22/2023, 2:31 PM
Hi ashish - every code location also has a standing service that is used to execute your code when running things like sensors (which poll periodically) or to do some validation against your code in Dagit when doing things like creating graph subsets or generating a snapshot before launching a run. It's possible to configure your agent so that these services have a TTL and spin down when they're not being used, but that may increase the startup time when you use the code location again while it spins the service back up.
a

ashish meshram

03/22/2023, 3:11 PM
thanks for the information , daniel do you have any sample for this one ?
d

daniel

03/22/2023, 3:12 PM
for the TTL? Here's an example config: https://docs.dagster.io/dagster-cloud/deployment/agents/customizing-configuration#enabling-user-code-server-ttl - for ECS that would involve modifying the task definition for the agent to include that server_ttl in the dagster.yaml file that it uses
D 1
a

ashish meshram

03/23/2023, 8:25 AM
adding this works, thanks daniel 🙂 here is a code for future ref :
Copy code
user_code_launcher:
                  module: dagster_cloud.workspace.ecs
                  class: EcsUserCodeLauncher
                  config:
                    cluster: ${ConfigCluster}
                    subnets: [${ConfigSubnet}]
                    service_discovery_namespace_id: ${ServiceDiscoveryNamespace}
                    execution_role_arn: ${TaskExecutionRole.Arn}
                    task_role_arn: ${AgentRole}
                    log_group: ${AgentLogGroup}
                    launch_type: ${TaskLaunchType}
                    server_ttl:
                      enabled: true
                      ttl_seconds: 300
15 Views