tlo.cli module

The TLOmodel command-line interface

print_basic_job_details(job: dict)

Display basic job information

load_config(config_file)

Load configuration for accessing Batch services

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

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(client_id, secret, tenant_id, url)

Create a Batch service client

load_scenario(scenario_file)

Load the Scenario class from the specified file

is_file_clean(scenario_file)

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)

Prints the contents of the specified Batch exception.

Parameters:

batch_exception

create_file_share(connection_string, share_name)

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

create_directory(connection_string, share_name, dir_name)

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)

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, subnet_id)

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

Parameters:
  • subnet_id

  • 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)

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.