Minimal docker project¶
Description¶
This example will show you a minimal project that will allow you to build a docker
image that will be able to run your orchestration files.
Project description¶
Project tree
minimal_docker_project
├── code/
│ ├── main.py
│ └── run_templates/
│ └── RUN/
│ └── run.json
├── Dockerfile
└── requirements.txt
File content¶
code/main.py | |
---|---|
1 2 3 |
|
This python file will be run by using a simple orchestration file.
code/run_templates/RUN/run.json | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Now we only need to add our requirements for the project:
requirements.txt
cosmotech-run-orchestrator==1.1.0
And to finish a simple Dockerfile to build our docker image:
Dockerfile
FROM python:latest
COPY requirements.txt .
RUN python3 -m pip install -r requirements.txt
# The code folder must be set in this position to work
# with the predefined entrypoint of csm-orc
COPY code /pkg/share/code
# Defining a run template ID here allows to have a default for the image
# and thus avoid having to define the EnvVar at run
ENV CSM_RUN_TEMPLATE_ID=RUN
# The following command is the entrypoint defined by csm-orc that will do
# a default run of your template.
# This command is hidden in the list of commands,
# but you can check it by running `csm-orc entrypoint --help`
ENTRYPOINT ["csm-orc", "entrypoint"]
Build the image¶
The image can be simply built using the following command:
Build the docker image
docker build . -t minimal_docker_orchestrator
Run the image¶
The image can then be run using the following command:
Run the docker image
docker run example_orc
Possible environment variables with the Cosmo Tech API¶
The Cosmo Tech API can send the following list of environment variable to your docker image which will be available for any orchestration file you may want to run in it
List of environment variables
Environment Variable | Description |
---|---|
AZURE_CLIENT_ID | An identifier to an Azure identity defined during the installation of the platform |
AZURE_CLIENT_SECRET | A secret tied to the given client ID allowing to connect with it |
AZURE_TENANT_ID | An identifier of your Azure tenant to be able to connect to it |
IDENTITY_PROVIDER | Will be set to azure in an Azure based API |
CSM_API_URL | The url to the Cosmo Tech API your are connecting to |
CSM_API_SCOPE | An identifier scope used to get permission to your API |
CSM_DATASET_ABSOLUTE_PATH | A local folder path to which an external volume is mounted to and in which you can write datasets |
CSM_PARAMETERS_ABSOLUTE_PATH | A local folder path to which an external volume is mounted to and in which you can write parameters |
TWIN_CACHE_HOST | The URL to the twin cache service inside the platform (deprecated) |
TWIN_CACHE_PORT | The port to the twin cache service inside the platform (deprecated) |
TWIN_CACHE_PASSWORD | The password to the twin cache service inside the platform (deprecated) |
TWIN_CACHE_USERNAME | The username to the twin cache service inside the platform (deprecated) |
CSM_SIMULATION_ID | The Simulation ID for your current scenario run |
AZURE_DATA_EXPLORER_RESOURCE_URI | The URI used to query an Azure Data Explorer Cluster tied to your Workspace |
AZURE_DATA_EXPLORER_RESOURCE_INGEST_URI | The URI used to send data to an Azure Data Explorer Cluster tied to your Workspace |
AZURE_DATA_EXPLORER_DATABASE_NAME | The name of the database of your Workspace in Azure Data Explorer |
CSM_ORGANIZATION_ID | The ID of your Organization in the Cosmo Tech API |
CSM_WORKSPACE_ID | The ID of your Workspace in the Cosmo Tech API |
CSM_SCENARIO_ID | The ID of your Scenario in the Cosmo Tech API |
CSM_RUN_TEMPLATE_ID | The ID of your Run Template in the Cosmo Tech API (as defined in your Solution) |
CSM_CONTAINER_MODE | Will always be csm-orc left for compatibility with pre 3.0 API |
CSM_ENTRYPOINT_LEGACY | Will always be false |
CSM_PROBES_MEASURES_TOPIC | An amqp address used by the simulator to send your probe data to ADX via Event Hub |
CSM_CONTROL_PLANE_TOPIC | An amqp address used by the simulator to send your control info to ADX via Event Hub (mostly number of measures sent) |
CSM_SIMULATION | The Simulation file that should be used to run your simulation (this value is defined in your Run Template and targets one of the files in the Simulation/ folder) |