Author Topic: Query host states  (Read 7061 times)

Twols

  • Jr. Member
  • **
  • Posts: 2
Query host states
« on: April 11, 2011, 08:36:30 AM »
Hi guys,
  I'm using qb.hostinfo to query the states of workers.  The result is a bit different compare to what I see from the GUI -- running/idle/locked are all categorized under "active". Is there anyway I can acquire the states which is shown on "resource summary" page?

  Thanks



Twols

  • Jr. Member
  • **
  • Posts: 2
Re: Query host states
« Reply #1 on: April 12, 2011, 03:22:29 AM »
I think I found the answer: query host.resources to get the processors info, 0/0 = locked, 0/1 = idle and 1/1 = running.

Peace.

jburk

  • Administrator
  • *****
  • Posts: 493
Re: Query host states
« Reply #2 on: April 12, 2011, 04:52:06 PM »
Well done.

That's exactly the right answer; the states we show in the GUI are derived from the processor counts.

In the databases, an "active" host is simply one that is not "down" or in a "panic" state, and is responding to questions from the supervisor.  Differentiating between 'idle' and 'running' is only done in the GUI by checking the if the number of processors reserved is greater than 1.

A locked worker is any worker that has n/0 processors; a host can be locked but still running a job if the job didn't get purged when the host got locked.  At some point when the job finishes the proc count will be 0/0, but you can't necessarily depend on it being 0/0 for all locked hosts.

To summarize:

locked is n/0, where n is any number
idle is 0/n, where n>1
running is n/m, where n>1 and m>1