P-AIRCARS HPC Cluster Module

paircars.clusterutils.slurm_cluster module

paircars.clusterutils.slurm_cluster.get_available_nodes(partition=None)[source]

Get available nodes of the partition

Parameters:

partition (str, optional) – Partition name

Returns:

Available node names

Return type:

list

paircars.clusterutils.slurm_cluster.get_max_walltime(partition)[source]

Get maximum wall time for the partition

Parameters:

partition (str) – Partition name

Returns:

Maximum wall time

Return type:

str

paircars.clusterutils.slurm_cluster.get_slurm_dask_cluster(dask_dir, jobid=None, cpu_frac=0.8, mem_frac=0.8, min_mem=1, max_worker=-1, partition=None, account=None, walltime=None, python_path=None, spill_frac=0.7, verbose=True)[source]

Launch a SLURMCluster

Parameters:
  • dask_dir (str) – Dask working directory (for temporary files)

  • jobid (int) – JobID of P-AIRCARS to avoid mixup of cluster configurration with other P-AIRCARS jobs.

  • cpu_frac (float, optional) – CPU fraction to use

  • mem_frac (float, optional) – Memory fraction to use

  • min_mem (float, optional) – Minimum per job memory in GB

  • max_worker (float, optional) – Maximum number of worker

  • partition (str, optional) – SLURM partition name Note: If your cluster requires this, you should provide. Otherwise, error will occur.

  • account (str, optional) – SLURM account name Note: If your cluster requires this, you should provide. Otherwise, error will occur.

  • walltime (str, optional) – Job walltime, maximum time the SLURM job can run (HH:MM:SS)

  • spill_frac (float) – Fraction of memory to spill to disk

  • verbose (bool) – Print Dask dashboard URL and diagnostics

Returns:

  • client (dask.distributed.Client) – Connected Dask client

  • cluster (dask_jobqueue.SLURMCluster) – SLURM Dask cluster

  • str – Dask directory used

paircars.clusterutils.slurm_cluster.get_slurm_node_resources(partition=None, cpu_frac=0.8, mem_frac=0.8)[source]

Get node resources for SLURM cluster

Parameters:
  • partition (str, optional) – Partition name

  • cpu_frac (float, optional) – CPU fraction to use

  • mem_frac (float, optional) – Memory fraction to use

Returns:

  • int – Number of CPU threads

  • float – Memory in GB

paircars.clusterutils.slurm_cluster.is_slurm_job()[source]

Check whether a job is submitted as slurm job or not

paircars.clusterutils.slurm_cluster.slurm_time_to_seconds(timestr)[source]

Convert SLURM time format (D-HH:MM:SS or HH:MM:SS) to seconds.

Parameters:

timestr (str) – Time string in SLURM format

Returns:

Time in seconds

Return type:

float

paircars.clusterutils.slurm_cluster.submit_slurm_master_flow(args, jobid)[source]

Submit P-AIRCARS master flow to a slurm cluster

Parameters:
  • args (dict) – Arparser dictionary

  • jobid (int) – P-AIRCARS jobid

Returns:

Success message

Return type:

int