Re: [gridengine users] Sorting qhost and choosing qstat columns

2019-08-01 Thread Skylar Thompson
I would definitely not recommend parsing XML in bash (or any other language
that doesn't implement nested data structures), but Perl XML::LibXML has
been a handy library for implementing our custom parsing of q* XML output.
These days I would probably use Python or Ruby but I wrote our tools many
years ago so Perl it was...

On Thu, Aug 01, 2019 at 10:59:09AM -0400, David Trimboli wrote:
> Changing the names isn't an option; I inherited these names years ago and
> nobody's going to want me to change them because I want to see something in
> order. :)
> 
> Basically, I can run this command to see it the way I want it:
>     qhost | head -n 3; qhost | tail -n +4 | sort -V
> but of course this is cumbersome and makes adding options a chore. (Suppose
> I want to use -j?)
> 
> I guess XML it is. If this were PowerShell it'd be a cinch, but working in
> Bash... ugh...
> 
> On 8/1/2019 10:39 AM, MacMullan IV, Hugh wrote:
> > David,
> > 
> > Best for qhost sort would be to change your 'cluster' names to zero-padded, 
> > if you really want that kind of sorting. Or you could create an alias like 
> > 'qhost | sort -nk 1.8', assuming 'clusterX' is always true (the 8th 
> > character is where you start the sort).
> > 
> > As Skylar says, if you want a custom qstat, you should probably build one 
> > from the '-xml' output.
> > 
> > Regards,
> > -Hugh
> > 
> > -Original Message-
> > From: users-boun...@gridengine.org  On Behalf 
> > Of David Trimboli
> > Sent: Thursday, August 1, 2019 9:59 AM
> > To: users Users 
> > Subject: [gridengine users] Sorting qhost and choosing qstat columns
> > 
> > When I run qhost, the output is sorted alphabetically ??? which means
> > "cluster10" appears before "cluster2," and so on.
> > 
> > Before I go writing bash functions to manually sort this, which might
> > lead to output side-effects, is there any way to change the sort to a
> > natural number sort, so that "cluster2" would appear before "cluster10,"
> > etc.?
> > 
> > When I run qstat, the normal wraps to a second line in my terminal set
> > to 120 columns. I could fix that by eliminating the "jclass" column,
> > which doesn't contain any information, but I can only find ways to add
> > columns, not take them away. Is there a way to make this column go away?
> > 
> > ___
> > users mailing list
> > users@gridengine.org
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__gridengine.org_mailman_listinfo_users=DwIGaQ=mkpgQs82XaCKIwNV8b32dmVOmERqJe4bBOtF0CetP9Y=EKk3zFVROsf8w5OyB2T6u55jzploih3y7CaWIlGOLAY=m_wX_jPeroRg7CYImv_hhYP5_j4Yg77eKMrgzOYGdVY=pwdLspfOZXCXUKlxE7OGCCu9y5Pg8hqoWxsY3gcb6Ls=
> ___
> users mailing list
> users@gridengine.org
> https://gridengine.org/mailman/listinfo/users

-- 
-- Skylar Thompson (skyl...@u.washington.edu)
-- Genome Sciences Department, System Administrator
-- Foege Building S046, (206)-685-7354
-- University of Washington School of Medicine
___
users mailing list
users@gridengine.org
https://gridengine.org/mailman/listinfo/users


Re: [gridengine users] Sorting qhost and choosing qstat columns

2019-08-01 Thread David Trimboli


On 8/1/2019 11:24 AM, Reuti wrote:

Hi,


Am 01.08.2019 um 15:58 schrieb David Trimboli :

When I run qhost, the output is sorted alphabetically — which means "cluster10" appears 
before "cluster2," and so on.

Before I go writing bash functions to manually sort this, which might lead to output side-effects, 
is there any way to change the sort to a natural number sort, so that "cluster2" would 
appear before "cluster10," etc.?
When I run qstat, the normal wraps to a second line in my terminal set to 120 columns. I 
could fix that by eliminating the "jclass" column, which doesn't contain any 
information, but I can only find ways to add columns, not take them away. Is there a way 
to make this column go away?

Besides `cut -b`: what type of output are you looking for? There is a `qstatus` 
AWK script in SoGE which displays the relevant columns including a longer job 
name.

-- Reuti



Hmm, good point! This seems to do what I need:

    qstat -u '*' | cut -b 1-100,121-140

___
users mailing list
users@gridengine.org
https://gridengine.org/mailman/listinfo/users


Re: [gridengine users] Sorting qhost and choosing qstat columns

2019-08-01 Thread Fred Youhanaie

Hi

On 01/08/2019 15:59, David Trimboli wrote:


I guess XML it is. If this were PowerShell it'd be a cinch, but working in 
Bash... ugh...


I'm not a PowerShell user, but I believe it is available for Linux.

This should help, unless you are prevented from installing it on your cluster 
due to local policies!

Cheers,
Fred
___
users mailing list
users@gridengine.org
https://gridengine.org/mailman/listinfo/users


Re: [gridengine users] Sorting qhost and choosing qstat columns

2019-08-01 Thread Reuti
Hi,

> Am 01.08.2019 um 15:58 schrieb David Trimboli :
> 
> When I run qhost, the output is sorted alphabetically — which means 
> "cluster10" appears before "cluster2," and so on.
> 
> Before I go writing bash functions to manually sort this, which might lead to 
> output side-effects, is there any way to change the sort to a natural number 
> sort, so that "cluster2" would appear before "cluster10," etc.?
> When I run qstat, the normal wraps to a second line in my terminal set to 120 
> columns. I could fix that by eliminating the "jclass" column, which doesn't 
> contain any information, but I can only find ways to add columns, not take 
> them away. Is there a way to make this column go away?

Besides `cut -b`: what type of output are you looking for? There is a `qstatus` 
AWK script in SoGE which displays the relevant columns including a longer job 
name.

-- Reuti
___
users mailing list
users@gridengine.org
https://gridengine.org/mailman/listinfo/users


Re: [gridengine users] Sorting qhost and choosing qstat columns

2019-08-01 Thread David Trimboli
Changing the names isn't an option; I inherited these names years ago 
and nobody's going to want me to change them because I want to see 
something in order. :)


Basically, I can run this command to see it the way I want it:
    qhost | head -n 3; qhost | tail -n +4 | sort -V
but of course this is cumbersome and makes adding options a chore. 
(Suppose I want to use -j?)


I guess XML it is. If this were PowerShell it'd be a cinch, but working 
in Bash... ugh...


On 8/1/2019 10:39 AM, MacMullan IV, Hugh wrote:

David,

Best for qhost sort would be to change your 'cluster' names to zero-padded, if 
you really want that kind of sorting. Or you could create an alias like 'qhost 
| sort -nk 1.8', assuming 'clusterX' is always true (the 8th character is where 
you start the sort).

As Skylar says, if you want a custom qstat, you should probably build one from 
the '-xml' output.

Regards,
-Hugh

-Original Message-
From: users-boun...@gridengine.org  On Behalf Of 
David Trimboli
Sent: Thursday, August 1, 2019 9:59 AM
To: users Users 
Subject: [gridengine users] Sorting qhost and choosing qstat columns

When I run qhost, the output is sorted alphabetically — which means
"cluster10" appears before "cluster2," and so on.

Before I go writing bash functions to manually sort this, which might
lead to output side-effects, is there any way to change the sort to a
natural number sort, so that "cluster2" would appear before "cluster10,"
etc.?

When I run qstat, the normal wraps to a second line in my terminal set
to 120 columns. I could fix that by eliminating the "jclass" column,
which doesn't contain any information, but I can only find ways to add
columns, not take them away. Is there a way to make this column go away?

___
users mailing list
users@gridengine.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__gridengine.org_mailman_listinfo_users=DwIGaQ=mkpgQs82XaCKIwNV8b32dmVOmERqJe4bBOtF0CetP9Y=EKk3zFVROsf8w5OyB2T6u55jzploih3y7CaWIlGOLAY=m_wX_jPeroRg7CYImv_hhYP5_j4Yg77eKMrgzOYGdVY=pwdLspfOZXCXUKlxE7OGCCu9y5Pg8hqoWxsY3gcb6Ls=

___
users mailing list
users@gridengine.org
https://gridengine.org/mailman/listinfo/users


Re: [gridengine users] Sorting qhost and choosing qstat columns

2019-08-01 Thread MacMullan IV, Hugh
David,

Best for qhost sort would be to change your 'cluster' names to zero-padded, if 
you really want that kind of sorting. Or you could create an alias like 'qhost 
| sort -nk 1.8', assuming 'clusterX' is always true (the 8th character is where 
you start the sort).

As Skylar says, if you want a custom qstat, you should probably build one from 
the '-xml' output.

Regards,
-Hugh

-Original Message-
From: users-boun...@gridengine.org  On Behalf Of 
David Trimboli
Sent: Thursday, August 1, 2019 9:59 AM
To: users Users 
Subject: [gridengine users] Sorting qhost and choosing qstat columns

When I run qhost, the output is sorted alphabetically — which means 
"cluster10" appears before "cluster2," and so on.

Before I go writing bash functions to manually sort this, which might 
lead to output side-effects, is there any way to change the sort to a 
natural number sort, so that "cluster2" would appear before "cluster10," 
etc.?

When I run qstat, the normal wraps to a second line in my terminal set 
to 120 columns. I could fix that by eliminating the "jclass" column, 
which doesn't contain any information, but I can only find ways to add 
columns, not take them away. Is there a way to make this column go away?

___
users mailing list
users@gridengine.org
https://gridengine.org/mailman/listinfo/users

___
users mailing list
users@gridengine.org
https://gridengine.org/mailman/listinfo/users


Re: [gridengine users] Sorting qhost and choosing qstat columns

2019-08-01 Thread Skylar Thompson
I'm not aware of any way to change the sort order or remove columns without
other side-effects (though I do note that "qstat -f" does not have the
column), but both of these commands do have a XML output option ("-xml")
which you could use to write your own reporting utilities.

On Thu, Aug 01, 2019 at 09:58:49AM -0400, David Trimboli wrote:
> When I run qhost, the output is sorted alphabetically ??? which means
> "cluster10" appears before "cluster2," and so on.
> 
> Before I go writing bash functions to manually sort this, which might lead
> to output side-effects, is there any way to change the sort to a natural
> number sort, so that "cluster2" would appear before "cluster10," etc.?
> 
> When I run qstat, the normal wraps to a second line in my terminal set to
> 120 columns. I could fix that by eliminating the "jclass" column, which
> doesn't contain any information, but I can only find ways to add columns,
> not take them away. Is there a way to make this column go away?
> 
> ___
> users mailing list
> users@gridengine.org
> https://gridengine.org/mailman/listinfo/users

-- 
-- Skylar Thompson (skyl...@u.washington.edu)
-- Genome Sciences Department, System Administrator
-- Foege Building S046, (206)-685-7354
-- University of Washington School of Medicine
___
users mailing list
users@gridengine.org
https://gridengine.org/mailman/listinfo/users