Azure batch functions

greedguler_batch.create_job(batch_client, name_job, name_pool, cmd_prep_task=None)

Creates a new job in Azure Batch with a specified job and pool name, and an optional preparation task command.

The job is configured to run in a pool identified by name_pool. A preparation task with the specified command is added to the job if cmd_prep_task is provided.

Parameters:
  • batch_client – The Batch service client to interact with the Azure Batch service.

  • name_job (str) – The name identifier for the new job.

  • name_pool (str) – The name of the pool where the job will run.

  • cmd_prep_task (str, optional) – The command line to execute as a preparation task for the job. Defaults to None.

greedguler_batch.create_pool(batch_client, name_pool, cmd_s_task=None, rule_scale_pool=None)

Creates a new pool in Azure Batch with a specified name, optional startup task command, and optional autoscale formula.

The pool is configured to use Ubuntu Server 20.04 LTS images from Canonical and is set for auto-scaling based on the provided formula. Inter-node communication is enabled.

Parameters:
  • batch_client – The Batch service client to interact with the Azure Batch service.

  • name_pool (str) – The name identifier for the new pool.

  • cmd_s_task (str, optional) – The command line to execute as a startup task for each node in the pool. Defaults to None.

  • rule_scale_pool (str, optional) – The autoscale formula to apply for scaling the pool. Defaults to None.

greedguler_batch.create_task(batch_client, name_job, cmd, name_task, param_multi_inst=None)

Creates a new task in a specified Azure Batch job with a command line to execute and optional multi-instance settings.

The task’s output files are configured to upload to a blob container upon task completion. The function also creates a JSON file to store output file destinations.

Parameters:
  • batch_client – The Batch service client to interact with the Azure Batch service.

  • name_job (str) – The name of the job where the task will be added.

  • cmd (str) – The command line to execute for the task.

  • name_task (str) – The name identifier for the new task.

  • param_multi_inst (models.MultiInstanceSettings, optional) – Settings for running the task across multiple compute nodes. Defaults to None.

Returns:

The destination for the task’s output files.

Return type:

models.OutputFileDestination

greedguler_batch.download_files_from_blob(blob_service_client: BlobServiceClient)

Downloads all files from a specified Azure Blob Storage container named “results”.

Each file from the container is downloaded to a local directory named “./results”, preserving the blob structure.

Parameters:

blob_service_client (BlobServiceClient) – The client to interact with the Azure Blob Storage service.

greedguler_batch.git_push_changes(repo_dir, commit_message='Automated Repo Update')

Pushes changes in the specified directory to the remote Git repository and waits until the operation is complete. This function ensures that the current working directory is reverted back to its original path after operation. :param repo_dir: Directory of the Git repository. :param commit_message: Commit message.