Debian Codegraph @

script/ecaccess-job-restart

raw
1 #!/usr/bin/perl -w
2 #
3 # ecaccess-job-restart: Restart an ECaccess Job
4 #
5 # [email protected] - 2010-10-15
6
7 use ECMWF::ECaccess;
8 use Getopt::Long;
9 use Pod::Usage;
10
11 my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 );
12
13 pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions(
14 \%opt,
15 qw(
16 version
17 help|?
18 manual
19 retry=i
20 debug
21 )
22 );
23
24 # Display version if requested
25 die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} );
26
27 my $jobId = $ARGV[0];
28
29 pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} );
30 pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} );
31 pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No job-id specified!\n" ) if not($jobId);
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 # Delete the Job
43 $controlChannel->restartJob( $token, $jobId );
44
45 # Logout
46 END {
47 $ecaccess->releaseToken($token) if ($token);
48 }
49
50 __END__
51
52 =head1 NAME
53
54 ecaccess-job-restart - Restart an ECaccess Job
55
56 =head1 SYNOPSIS
57
58 B<ecaccess-job-restart -version|-help|-manual>
59
60 B<ecaccess-job-restart [-debug]> I<job-id>
61
62 =head1 DESCRIPTION
63
64 If the job with identifier I<job-id> fails, this command instruct ECaccess to rerun it.
65
66 =head1 ARGUMENTS
67
68 =over 8
69
70 =item I<job-id>
71
72 The identifier of the ECaccess Job to restart.
73
74 =back
75
76 =head1 OPTIONS
77
78 =over 8
79
80 =item B<-version>
81
82 Display version number and exits.
83
84 =item B<-help>
85
86 Print a brief help message and exits.
87
88 =item B<-manual>
89
90 Prints the manual page and exits.
91
92 =item B<-retry> I<count>
93
94 Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the
95 initial SSL connection initiated by the command to the ECMWF server. It does not
96 apply to all the subsequent requests made afteward as it is mainly targeting errors
97 that can happen from time to time during the SSL handshake. Default is no retry.
98
99 =item B<-debug>
100
101 Display the SOAP and SSL messages exchanged.
102
103 =back
104
105 =head1 EXAMPLES
106
107 B<ecaccess-job-restart> I<124356>
108
109 Restart the ECaccess Job with the identifier I<124356>.
110
111 =head1 SEE ALSO
112
113 B<ecaccess-job-delete>, B<ecaccess-job-get>, B<ecaccess-job-list>,
114 B<ecaccess-job-submit> and B<ecaccess>.
115
116 =cut