Mailing List Archives
Authenticated access
|
|
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Condor-users] Process id of job?
- Date: Thu, 13 Mar 2008 06:26:46 -0500
- From: Todd Tannenbaum <tannenba@xxxxxxxxxxx>
- Subject: Re: [Condor-users] Process id of job?
Nguyen Chi Hiep wrote:
Hi all,
I submit a job to a condor pool and I want to get the information about
this job (process id of this job and what host job is running on) via
SOAP API.
What .wsdl will I use? Please tell me more detail if you can!
Well, most information about a job in Condor is contained in the
so-called "job ClassAd" for the job. With the command-line tools,
"condor_q" is the tool to see job classads (see the condor_q man page).
If you do "condor_q -l" you will see the complete job classad.
If you want to use the SOAP API to get the job classads and thus access
to the same information that condor_q can give you, you will want to use
the condorSchedd.wsdl which contains the interface to talk to the
condor_schedd daemon which is the service that holds the job queue. I
don't know if you use Perl, but by way of example below is a quick Perl
script that can do the equal of "condor_q -l" or "condor_q -l
-constraint ..." by talking SOAP to Condor via the Perl SOAP::Lite module.
By default the condor_schedd daemon runs on a dynamic port. So you may
want to either specify a static port for the schedd to use in your
condor_config, or else you will also have to use the
condorCollector.wsdl interface to query the condor_collector to find out
what port the schedd is listening on. To specify a specific port to use
with any condor daemon, use the "-p <port>" command-line option.
Normally, the condor_master daemon starts up all the other daemons on a
machine for you, so use SCHEDD_ARGS in condor_config to tell the
condor_master to pass some command-line options to the schedd. So for
example if you wanted the schedd to use a well-known port of 1982, put
in your condor_config
SCHEDD_ARGS = -p 1982
Quickie condor_q example to pull job info from a condor_schedd daemon
listening on the well-known port of 1982 on foo.edu :
# Use SOAP::Lite as our web service client
use SOAP::Lite;
# Replace the http URL below with the ip/port of your schedd
my $soap = SOAP::Lite->new(
proxy => 'http://foo.edu:1982/soap',
default_ns => 'urn:condor'
);
# Invoke the getJobAds method, passing along a constraint
# if the user gave us one on the command line.
my $som = $soap->call(
"getJobAds",
SOAP::Data->name('constraint')->value( $ARGV[0] || 'TRUE'),
);
# If the server reported a fault, exit
die $som->fault->{ faultstring } if ($som->fault);
my %result = %{$som->result};
# Condor returns what is essentially an array of ClassAds
# as the result. Unfortunately, SOAP::Lite translates this
# into an array if two or more ads is returned (good), and
# as a hash if only one ad is returned (silly). Here we always make
# the result an array by creating an array with one ad if
# SOAP::Lite gave us a hash.
my @ads;
if( ref ($result{'classAdArray'}{'item'}) eq 'HASH') {
@ads = $result{'classAdArray'}{'item'};
} else {
@ads = @{$result{'classAdArray'}{'item'}};
}
# Now iterate through the results and print it out.
# Iterate through all ads....
foreach $ad_ref (@ads) {
my @ad = @{$ad_ref->{'item'}};
# In each ad, iterate through each job attribute...
foreach $attr_ref (@ad) {
my %attr = %$attr_ref;
# Each attribute is a hash, print out name and value...
print " $attr{'name'} = $attr{'value'} \n";
}
print "===============================\n";
}
--
Todd Tannenbaum University of Wisconsin-Madison
Condor Project Research Department of Computer Sciences
tannenba@xxxxxxxxxxx 1210 W. Dayton St. Rm #4257
Phone: (608) 263-7132 Madison, WI 53706-1685