Hi! I'm in the process of reorganizing my dagster ...
# deployment-ecs
j
Hi! I'm in the process of reorganizing my dagster code. I want to replace repositories with Definitions, so I need to set up multiple workspaces. I have done this by using several grpc server ports and several task definitions. I am not sure that this method is the most relevant, because it requires to define several tasks with the same configuration. Is there a better way to do this?
workspace.yaml
Copy code
load_from:
 - grpc_server:
       host: user_code
       port: 4000
       location_name: "definition_1"
 - grpc_server:
       host: user_code
       port: 4001
       location_name: "definition_2"
extract from the task definition file
Copy code
{
   "name": "definition_1",
   "image": "<http://767874247885.dkr.ecr.eu-west-1.amazonaws.com/deploy_ecs/user_code:latest|767874247885.dkr.ecr.eu-west-1.amazonaws.com/deploy_ecs/user_code:latest>",
   "command": [
    "dagster",
    "api",
    "grpc",
    "-h",
    "0.0.0.0",
    "-p",
    "4000",
    "-f",
    "definition_1.py"
   ]
},
{
   "name": "definition_2",
   "image": "<http://767874247885.dkr.ecr.eu-west-1.amazonaws.com/deploy_ecs/user_code:latest|767874247885.dkr.ecr.eu-west-1.amazonaws.com/deploy_ecs/user_code:latest>",
   "command": [
    "dagster",
    "api",
    "grpc",
    "-h",
    "0.0.0.0",
    "-p",
    "4001",
    "-f",
    "definition_2.py"
   ]
}
d
Hi Jordan - I'm not sure I would recommend replacing multiple repositories within a single code location with multiple code locations using Definitions. The main downside there is that now you have to maintain multiple standing servers, which might not be what you want. If you like the Definitions syntax you might also take a look at this method which might give you the best of both worlds? https://docs.dagster.io/_apidocs/definitions#dagster.create_repository_using_definitions_args