Skip to content

Commit

Permalink
chore: remove Python 2 print function support (#197)
Browse files Browse the repository at this point in the history
* chore: remove Python 2 print function support

* style: run black against examples directory
  • Loading branch information
giovtorres authored Nov 13, 2021
1 parent 22b3547 commit b1abc01
Show file tree
Hide file tree
Showing 33 changed files with 10 additions and 38 deletions.
1 change: 0 additions & 1 deletion examples/blocks_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Retrieve list of blocked items
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/blocks_list2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Retrieve list of blocked items
"""
from __future__ import print_function

from time import sleep

Expand Down
1 change: 0 additions & 1 deletion examples/cancel_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Cancel a scheduled job
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/checkpoint_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Retrieve a jobs checkpoint status
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Retrieve list up Slurm controllers
"""
from __future__ import print_function

import socket

Expand Down
1 change: 0 additions & 1 deletion examples/debug_levels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
How to set Slurm debug level
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/hostlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Retrieve Slurm hosts
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/job_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Class to access/modify Slurm Job Information.
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/jobs_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
List Slurm jobs
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/jobsteps_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Display Slurm jobsteps
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/jobsteps_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
List steps jobs have gone through
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/licenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
List Slurm licenses
"""
from __future__ import print_function


def display(lic_dict):
Expand Down
12 changes: 9 additions & 3 deletions examples/listdb_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ def job_display(job):

if __name__ == "__main__":
try:
start = (datetime.datetime.utcnow() - datetime.timedelta(days=1)).strftime("%Y-%m-%dT00:00:00")
end = (datetime.datetime.utcnow() + datetime.timedelta(days=1)).strftime("%Y-%m-%dT00:00:00")
start = (datetime.datetime.utcnow() - datetime.timedelta(days=1)).strftime(
"%Y-%m-%dT00:00:00"
)
end = (datetime.datetime.utcnow() + datetime.timedelta(days=1)).strftime(
"%Y-%m-%dT00:00:00"
)

jobs = pyslurm.slurmdb_jobs()
jobs_dict = jobs.get(starttime=start.encode('utf-8'), endtime=end.encode('utf-8'))
jobs_dict = jobs.get(
starttime=start.encode("utf-8"), endtime=end.encode("utf-8")
)
if jobs_dict:
for key, value in jobs_dict.items():
print("{} Job: {}".format("{", key))
Expand Down
1 change: 0 additions & 1 deletion examples/node_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
List Slurm nodes
"""
from __future__ import print_function


def display(node_dict):
Expand Down
2 changes: 0 additions & 2 deletions examples/node_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
Some states are not valid on a Blue Gene
"""

from __future__ import print_function

import pyslurm

Node_dict = {
Expand Down
1 change: 0 additions & 1 deletion examples/partition_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Create a slurm partition.
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/partition_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Delete a given slurm partition
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/partition_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
List Slurm partitions
"""
from __future__ import print_function


def display(part_dict):
Expand Down
1 change: 0 additions & 1 deletion examples/partition_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Update a given Slurm partitions
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/reservation_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Create a Slurm reservation
"""
from __future__ import print_function

import sys
import time
Expand Down
1 change: 0 additions & 1 deletion examples/reservation_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Delete Slurm reservations
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/reservation_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
List Slurm reservations
"""
from __future__ import print_function

import time

Expand Down
1 change: 0 additions & 1 deletion examples/reservation_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Update Slurm reservations
"""
from __future__ import print_function

import pyslurm

Expand Down
3 changes: 1 addition & 2 deletions examples/show-cluster-util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Print cluster utilization.
"""
from __future__ import print_function

import sys

Expand All @@ -20,7 +19,7 @@ def human_readable(num, suffix="B"):


def get_util(nodes):
""" Return a tuple of cpu and memory percent values."""
"""Return a tuple of cpu and memory percent values."""
all_metrics = {
"total_cpus_alloc": 0,
"total_cpus_idle": 0,
Expand Down
1 change: 0 additions & 1 deletion examples/sjobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
List Slurm jobs from certain users
"""
from __future__ import print_function

import sys
from pwd import getpwnam, getpwuid
Expand Down
1 change: 0 additions & 1 deletion examples/slurm_ctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Manipulate Slurm configuration
"""
from __future__ import print_function

import sys

Expand Down
1 change: 0 additions & 1 deletion examples/slurm_node_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Display Slurm node information in XML
"""
from __future__ import print_function

import os
import os.path
Expand Down
1 change: 0 additions & 1 deletion examples/slurm_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
List Slurm information as XML
"""
from __future__ import print_function

import socket
import sys
Expand Down
1 change: 0 additions & 1 deletion examples/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Display Slurm statistics
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/topo_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Display Slurm cluster topology
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/triggers_clear.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
Remove trigger by trigger ID
"""
from __future__ import print_function

import pyslurm

Expand Down
1 change: 0 additions & 1 deletion examples/triggers_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
List triggers
"""
from __future__ import print_function

import pyslurm

Expand Down
2 changes: 0 additions & 2 deletions examples/triggers_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
char * program
"""

from __future__ import print_function

import pyslurm

trigDict = {
Expand Down

0 comments on commit b1abc01

Please sign in to comment.