Debian Codegraph @

script/ecaccess-queue-list

raw
1 #!/usr/bin/perl -w
2 #
3 # ecaccess-queue-list: List available queues
4 #
5 # [email protected] - 2010-10-15
6
7 use ECMWF::ECaccess;
8 use Getopt::Long;
9 use Pod::Usage;
10 use Term::ReadKey;
11
12 my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 );
13
14 pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions(
15 \%opt,
16 qw(
17 version
18 help|?
19 manual
20 retry=i
21 debug
22 )
23 );
24
25 # Display version if requested
26 die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} );
27
28 my $queueName = $ARGV[0];
29
30 pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} );
31 pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} );
32
33 # Create the ECaccess Controler
34 my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug});
35
36 # Get the Token (using the Certificate in $HOME)
37 my $token = $ecaccess->getToken();
38
39 # Get the Control Channel
40 my $controlChannel = $ecaccess->getControlChannel();
41
42 if ( not($queueName) ) {
43
44 # Get the list of queues
45 my $queues = $controlChannel->getQueueList($token);
46
47 # Display the information for each queue
48 foreach $queue ( $queues->valueof('//getQueueListResponse/return') ) {
49 printf "%-15s %-15s %s (INIT=%s,WAIT=%s,EXEC=%s,DONE=%s,STOP=%s)\n", $queue->{queueName}, $queue->{schedulerName}, $queue->{comment},
50 $queue->{numberOfJobsInInitState}, $queue->{numberOfJobsInWaitState}, $queue->{numberOfJobsInExecState}, $queue->{numberOfJobsInDoneState},
51 $queue->{numberOfJobsInStopState};
52 }
53 }
54 else {
55
56 # Get the detail for the specified queue
57 foreach $queue ( $controlChannel->getQueueDetail( $token, $queueName )->valueof('//getQueueDetailResponse/return') ) {
58 printf "%-20s %s\n", $queue->{name}, $queue->{comment};
59 }
60 }
61
62 # Logout
63 END {
64 $ecaccess->releaseToken($token) if ($token);
65 }
66
67 __END__
68
69 =head1 NAME
70
71 ecaccess-queue-list - List available queues
72
73 =head1 SYNOPSIS
74
75 B<ecaccess-queue-list -version|-help|-manual>
76
77 B<ecaccess-queue-list [-debug]> B<[>I<queue-name>B<]>
78
79 =head1 DESCRIPTION
80
81 Two different types of queues are in use with ECaccess:
82
83 B<1> - The ECaccess batch queues, which correspond to one system at ECMWF with its specific batch environment, e.g. ecgate will
84 be the ECaccess queue, which will redirect jobs to ecgate at ECMWF, running LoadLeveler. This ECaccess queue will be given
85 as argument when submitting a batch job.
86
87 B<2> - The batch queues (or classes) on the systems at ECMWF will be given in the batch job with #@ class = for LoadLeveler.
88
89 The names of the ECaccess queues and associated batch queues at ECMWF can be seen with this command. When an ECaccess
90 I<queue-name> is specified then the details for this queue are displayed (including the list of classes).
91
92 The first ECaccess batch queue in the list is the default queue when submitting a batch job with the B<ecaccess-job-submit>
93 command.
94
95 =head1 ARGUMENTS
96
97 =over 8
98
99 =item I<queue-name> (optional)
100
101 The name of the ECaccess queue to retrieve the details.
102
103 =back
104
105 =head1 OPTIONS
106
107 =over 8
108
109 =item B<-version>
110
111 Display version number and exits.
112
113 =item B<-help>
114
115 Print a brief help message and exits.
116
117 =item B<-manual>
118
119 Prints the manual page and exits.
120
121 =item B<-retry> I<count>
122
123 Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the
124 initial SSL connection initiated by the command to the ECMWF server. It does not
125 apply to all the subsequent requests made afteward as it is mainly targeting errors
126 that can happen from time to time during the SSL handshake. Default is no retry.
127
128 =item B<-debug>
129
130 Display the SOAP and SSL messages exchanged.
131
132 =back
133
134 =head1 EXAMPLES
135
136 B<ecaccess-queue-list>
137
138 List all the ECaccess batch queues (or systems supporting job submission at ECMWF).
139
140 B<ecaccess-queue-list> I<ecgate>
141
142 List all the batch queues (or classes) on the ECMWF system I<ecgate>.
143
144 =head1 SEE ALSO
145
146 B<ecaccess>.
147
148 =cut