Skip to main content

Read Slurm sacct as pandas dataframes

Project description

Pandas sacct

Provides an Sacct class interface to the Slurm.

In general options to sacct (see man sacct) can passed by keyword to Sacct.

Usage

  • Sacct(flag=True) corresponds to sacct --flag.
  • Sacct(key=value) corresponds to sacct --key=value.
  • starttime and endtime options support both string and types that support .isoformat() such as pd.Timestamp().

examples

import sacct
s = sacct.Sacct(starttime="2020-08-30T00:00:00", endtime="2020-08-31T00:00:00", allocations=True)
df = s.execute()
print(s)
print(df.head())
sacct --format=jobidraw,start,end,nodelist --noheader --parsable2 --truncate --allocations --starttime=2020-08-30T00:00:00 --endtime=2020-08-31T00:00:00
   jobidraw               start                 end    nodelist
0  33891896 2020-08-30 03:01:58 2020-08-30 03:15:14  [nid01454]
1  33891898 2020-08-30 03:01:58 2020-08-30 03:04:59  [nid01565]
2  33891899 2020-08-30 03:07:13 2020-08-30 03:10:10  [nid01163]
3  33891900 2020-08-30 03:01:58 2020-08-30 03:15:56  [nid01998]
4  33891902 2020-08-30 03:01:58 2020-08-30 03:04:54  [nid01716]
import sacct
import pandas as pd
t0 = pd.Timestamp("2020-08-30T00:00:00")
t1 = t0 + pd.Timedelta(days=1)
s = sacct.Sacct(starttime=t0, endtime=t1, allocations=True, format=['jobidraw', 'jobname'], allusers=True)
df = s.execute()
print(s)
print(df.head())
sacct --format=jobidraw,jobname --noheader --parsable2 --truncate --allocations --starttime=2020-08-30T00:00:00 --endtime=2020-08-31T00:00:00 --allusers
   jobidraw   jobname
0  27731125  JT_D1_16
1  27731129  JT_D1_16
2  27731131  JT_D1_16
3  27731136  JT_D1_16
4  27731165  JT_D2_16
import sacct
import pandas as pd
t0 = pd.Timestamp("2020-08-30T00:00:00")
t1 = t0 + pd.Timedelta(days=1)
s = sacct.Sacct(starttime=t0, endtime=t1, format=['jobidraw', 'jobname'], allusers=True)
df = s.execute()
print(s)
print(df.head())
sacct --format=jobidraw,jobname --noheader --parsable2 --truncate --starttime=2020-08-30T00:00:00 --endtime=2020-08-31T00:00:00 --allusers
   jobidraw    step   jobname
0  29056157   batch     batch
1  29056157  extern    extern
2  29056157       0  lmp_cori
3  29056168   batch     batch
4  29056168  extern    extern

Specific sacct command (optional):

s = sacct.Sacct(sacct_cmd="/usr/bin/sacct", starttime="2020-08-30T00:00:00", endtime="2020-08-31T00:00:00", allocations=True)

Copywrite Notice

Pandas-sacct Copyright (c) 2020, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

If you have questions about your rights to use or distribute this software, please contact Berkeley Lab's Intellectual Property Office at IPO@lbl.gov.

NOTICE. This Software was developed under funding from the U.S. Department of Energy and the U.S. Government consequently retains certain rights. As such, the U.S. Government has been granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the Software to reproduce, distribute copies to the public, prepare derivative works, and perform publicly and display publicly, and to permit others to do so.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pandas-sacct-1.2.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pandas_sacct-1.2.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file pandas-sacct-1.2.0.tar.gz.

File metadata

  • Download URL: pandas-sacct-1.2.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for pandas-sacct-1.2.0.tar.gz
Algorithm Hash digest
SHA256 24034ab1682f64e9955773d044635c7741449d128b9e04519cb3d1acfdf10c2b
MD5 7e97307d82b52278421737aaeecb3fec
BLAKE2b-256 5e0e888a695f56fee68f3dfe0f9382e67428abbdfb49b2676130fa294753d00a

See more details on using hashes here.

File details

Details for the file pandas_sacct-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: pandas_sacct-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for pandas_sacct-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 313451d8b54f48515a563b82688e73ce5c1ec34ecc7e0f5099f8bec93b0b2a96
MD5 fd7fa0e377fc961bb2e883929d45e526
BLAKE2b-256 927062e0e08b6bb08438c71c04f5081f1d9925df9e4c2c232e81508a358560c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page