Giter Club home page Giter Club logo

Comments (1)

laparn avatar laparn commented on May 14, 2024

In fact, I have found the answers and it is split in 2.

  1. state
    The state for partition is not represented internally in slurm (cf slurm.h) as for the job. In slurm.h, you see :
    /* Partition state flags /
    #define PARTITION_SUBMIT 0x01 /
    Allow job submission to partition /
    #define PARTITION_SCHED 0x02 /
    Allow job startup from partition */

/* Actual partition states based upon state flags */
#define PARTITION_DOWN (PARTITION_SUBMIT)
#define PARTITION_UP (PARTITION_SUBMIT | PARTITION_SCHED)
#define PARTITION_DRAIN (PARTITION_SCHED)
#define PARTITION_INACTIVE 0x00

So in pyslurm the state_up value means : 0 => INACTIVE, 1=>DOWN, 2=>DRAIN,3=>UP

  1. Flags
    In the value of flags of the partition you have in fact all flags that are represented. From slurm.h :
    /* Current partition state information and used to set partition options
    • using slurm_update_partition(). /
      #define PART_FLAG_DEFAULT 0x0001 /
      Set if default partition /
      #define PART_FLAG_HIDDEN 0x0002 /
      Set if partition is hidden /
      #define PART_FLAG_NO_ROOT 0x0004 /
      Set if user root jobs disabled /
      #define PART_FLAG_ROOT_ONLY 0x0008 /
      Set if only root can submit jobs /
      #define PART_FLAG_REQ_RESV 0x0010 /
      Set if reservation is required /
      /
      Used with slurm_update_partition() to clear flags associated with existing
    • partitions. For example, if a partition is currently hidden and you want
    • to make it visible then set flags to PART_FLAG_HIDDEN_CLR and call
    • slurm_update_partition(). /
      #define PART_FLAG_DEFAULT_CLR 0x0100 /
      Clear DEFAULT partition flag /
      #define PART_FLAG_HIDDEN_CLR 0x0200 /
      Clear HIDDEN partition flag /
      #define PART_FLAG_NO_ROOT_CLR 0x0400 /
      Clear NO_ROOT partition flag /
      #define PART_FLAG_ROOT_ONLY_CLR 0x0800 /
      Clear ROOT_ONLY partition flag /
      #define PART_FLAG_REQ_RESV_CLR 0x1000 /
      Clear RES_REQ partition flag */

So, flags is holding the value for DEFAULT, HIDDEN, NO_ROOT, REQ_RESV (i suppose that it is the shared flag of scontrol show partition).

I ended up wrapping pyslurm in the following code (processed_part_dict hold the values of the partition dictionnary) :
state=processed_part_dict["state"]
if state == 0:
final_state = "(0, 'INACTIVE')"
elif state == 1:
final_state = "(1, 'DOWN')"
elif state == 2:
final_state = "(2, 'DRAIN')"
elif state == 3:
final_state = "(3, 'UP')"
else:
final_state = "(-1, 'UNKNOW')"
logger.error("SoapSlurm.py - list_partitions - unknown partition state :"+str(state))
processed_part_dict["state"]=final_state
# Now dealing with the flag
flags = processed_part_dict["flags"]
for flag in boolean_fields:
processed_part_dict[flag] = False
if ( flags | 65534 ) == 65535:
processed_part_dict["defaultPartition"] = True
if ( flags | 65533 ) == 65535:
processed_part_dict["hidden"] = True
if ( flags | 65531 ) == 65535:
processed_part_dict["noRoot"] = True
if ( flags | 65527 ) == 65535:
processed_part_dict["rootOnly"] = True
if ( flags | 65519 ) == 65535:
processed_part_dict["shared"] = True

from pyslurm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.