Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snippet to get number of pending and running jobs #73

Open
lesteve opened this issue Oct 18, 2021 · 1 comment
Open

Snippet to get number of pending and running jobs #73

lesteve opened this issue Oct 18, 2021 · 1 comment

Comments

@lesteve
Copy link
Member

lesteve commented Oct 18, 2021

import subprocess
import io
import shlex

import pandas as pd

squeue_command = shlex.split('squeue -p gpu_p13 -o "%i;%P;%j;%u;%T;%M;%l;%D;%R"')
squeue_output = subprocess.check_output(squeue_command).decode()

df = pd.read_csv(io.StringIO(squeue_output), sep=";")

for state in ("RUNNING", "PENDING"):
    print(state)
    print(
        df[df["STATE"] == state]
        .groupby("USER")["NODES"]
        .sum()
        .sort_values(ascending=False)
        .head(15)
    )
@lesteve lesteve changed the title Small snippet to get number of pending and running jobs Snippet to get number of pending and running jobs Oct 18, 2021
@lesteve
Copy link
Member Author

lesteve commented Oct 18, 2021

This can be useful to get an overall idea of the state of running and pending jobs. In particular this can be used to figure out whether some users have a lot of jobs pending/running and whether they tend to be very often the same users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant