Ejemplo n.º 1
0
 def _encode(self):
     hList = Hostlist(self._rv1NoSched["execution"]["nodelist"])
     vtx = FluxionResourcePoolV1(
         self._uniqId,
         "cluster",
         "cluster",
         "cluster0",
         0,
         self._uniqId,
         -1,
         True,
         "",
         1,
         "/cluster0",
     )
     self._add_and_tick_uniq_id(vtx, None)
     i = 0
     rdict = {}
     for entry in self._rv1NoSched["execution"]["R_lite"]:
         for rank in list(IDset(entry["rank"])):
             if rank in rdict:
                 raise Exception(f"R_lite: rank={rank} found again!")
             rdict[rank] = i
             i += 1
     for entry in self._rv1NoSched["execution"]["R_lite"]:
         self._encode_rlite(vtx.get_id(), entry, hList, rdict)
Ejemplo n.º 2
0
def drain_list():
    headings = {
        "timestamp": "TIMESTAMP",
        "ranks": "RANK",
        "reason": "REASON",
        "nodelist": "NODELIST",
    }
    resp = RPC(flux.Flux(), "resource.status").get()
    rset = ResourceSet(resp["R"])
    nodelist = rset.nodelist

    lines = []
    for ranks, entry in resp["drain"].items():
        ranks = IDset(ranks)
        line = StatusLine(
            "drain",
            ranks,
            Hostlist([nodelist[i] for i in ranks]),
            entry["reason"],
            entry["timestamp"],
        )
        lines.append(line)

    fmt = "{timestamp:<20} {ranks:<8} {reason:<30} {nodelist}"
    formatter = flux.util.OutputFormat(headings, fmt, prepend="0.")
    print(formatter.header())
    for line in lines:
        print(formatter.format(line))
Ejemplo n.º 3
0
    def append(self, state, ranks="", reason=None):
        #
        # If an existing status line has matching state and reason
        #  update instead of appending a new output line:
        #  (mainly useful for "drain" when reasons are not displayed)
        #
        hosts = Hostlist([self.nodelist[i] for i in ranks])
        rstatus = self.find(state, reason)
        if rstatus:
            rstatus.update(ranks, hosts)
        else:
            line = StatusLine(state, ranks, hosts, reason)
            self.bystate[f"{state}:{reason}"] = line
            self.statuslines.append(line)

        self._idset_update(state, ranks)
Ejemplo n.º 4
0
 def _encode(self):
     hIndex = -1
     hList = Hostlist(self._rv1NoSched["execution"]["nodelist"])
     vtx = FluxionResourcePoolV1(
         self._uniqId,
         "cluster",
         "cluster",
         "cluster0",
         0,
         self._uniqId,
         -1,
         True,
         "",
         1,
         "/cluster0",
     )
     self._add_and_tick_uniq_id(vtx, None)
     for entry in self._rv1NoSched["execution"]["R_lite"]:
         hIndex = self._encode_rlite(vtx.get_id(), entry, hList, hIndex)
Ejemplo n.º 5
0
def drain_list():
    headings = {
        "timestamp": "TIMESTAMP",
        "ranks": "RANK",
        "reason": "REASON",
        "nodelist": "NODELIST",
        "state": "STATE",
    }
    result = ListStatusRPC(flux.Flux())

    resp = result.get_status()
    allocated = result.get_allocated_ranks()

    rset = ResourceSet(resp["R"])
    nodelist = rset.nodelist

    lines = []
    for drain_ranks, entry in resp["drain"].items():
        for ranks, state in split_draining(IDset(drain_ranks), allocated):
            # Do not report empty or "drain" rank sets
            # Only draining & drained are reported in this view
            if not ranks or state == "drain":
                continue
            line = StatusLine(
                state,
                ranks,
                Hostlist([nodelist[i] for i in ranks]),
                entry["reason"],
                entry["timestamp"],
            )
            lines.append(line)

    fmt = "{timestamp:<20} {state:<8.8} {ranks:<8.8} {reason:<30} {nodelist}"
    formatter = flux.util.OutputFormat(headings, fmt, prepend="0.")
    print(formatter.header())
    for line in lines:
        print(formatter.format(line))
Ejemplo n.º 6
0
 def nodelist(self):
     return Hostlist(handle=self.pimpl.nodelist())