tlo.cli module

The TLOmodel command-line interface

print_basic_job_details(job: dict)[source]

Display basic job information

load_config(config_file)[source]

Load configuration for accessing Batch services

load_server_config(kv_uri, tenant_id) Dict[str, Dict][source]

Retrieve the server configuration for running Batch using the user’s Azure credentials

Allows user to login using credentials from Azure CLI or interactive browser.

On Windows, login might fail because pywin32 is not installed correctly. Resolve by running (as Administrator) python Scriptspywin32_postinstall.py -install For more information, see https://github.com/mhammond/pywin32/issues/1431

get_batch_client(name, key, url)[source]

Create a Batch service client

load_scenario(scenario_file)[source]

Load the Scenario class from the specified file

is_file_clean(scenario_file)[source]

Checks whether the scenario file and current branch is clean and unchanged.

Returns:

current branch name if all okay, False otherwise

print_batch_exception(batch_exception)[source]

Prints the contents of the specified Batch exception.

Parameters:

batch_exception

create_file_share(connection_string, share_name)[source]

Uses a ShareClient object to create a share if it does not exist.

create_directory(connection_string, share_name, dir_name)[source]

Creates a directory in the root of the specified file share by using a ShareDirectoryClient object.

upload_local_file(connection_string, local_file_path, share_name, dest_file_path)[source]

Uploads the contents of the specified file into the specified directory in the specified Azure file share.

create_job(batch_service_client, vm_size, pool_node_count, job_id, container_conf, mount_configuration, keep_pool_alive)[source]

Creates a job with the specified ID, associated with the specified pool.

Parameters:
  • batch_service_client (azure.batch.BatchServiceClient) – A Batch service client.

  • vm_size (str) – Type of virtual machine to use as pool.

  • pool_node_count (int) – Number of nodes in the pool.

  • job_id (str) – The ID for the job.

  • container_conf (azure.batch.models.ContainerConfiguration) – Configuration of a container.

  • mount_configuration (list[azure.batch.models.MountConfiguration]) – Configuration of the images to mount on the nodes.

  • keep_pool_alive (bool) – auto pool lifetime configuration - use to debug

add_tasks(batch_service_client, user_identity, job_id, image_name, container_run_options, scenario, command)[source]

Adds the simulation tasks in the collection to the specified job.

Parameters:
  • batch_service_client (azure.batch.BatchServiceClient) – A Batch service client.

  • user_identity (azure.batch.models.UserIdentity) – User account to use in the jobs.

  • job_id (str) – The ID of the job to which to add the tasks.

  • image_name (str) – Name of the Docker image to mount for the task.

  • container_run_options (str) – Options to pass to Docker to run the image.

  • scenario (scenario.Scenario) – instance of Scenario we’re running

  • command (str) – Command to run during the taks inside the Docker image.