[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Condor-users] cluster number in shell script (sh)



I use environment variables.  Here is an example using perl.

My condor script
executable = hostname.pl
universe = globus
grid_resource = gt2 hydrogen/jobmanager
environment = CLUSTER=$(cluster);PROCESS=$(Process)

output = hostname.out.$(cluster).$(Process)
log = condorg.log.$(cluster).$(Process)

should_transfer_files = YES
when_to_transfer_output = ON_EXIT

queue 3

My perl script
#!/usr/bin/perl -w
use strict;

open (FILE, `>hostname.out.$ENV{CLUSTER}.$ENV{PROCESS}`);
open DATA, "hostname |"   or die "Couldn't execute program: $!";
while ( defined( my $line = <DATA> )  ) {
  chomp($line);
  print FILE "$line\n";
}
close FILE;
close DATA;

Kevin
-----Original Message-----
From: condor-users-bounces@xxxxxxxxxxx
[mailto:condor-users-bounces@xxxxxxxxxxx] On Behalf Of Alexandru Chiscan
Sent: Monday, November 29, 2010 1:32 AM
To: Condor-Users Mail List
Subject: [Condor-users] cluster number in shell script (sh)


    Hello all,

I am using shell scripts to generate condor submit files and to submit
them.
The scripts generate clusters with many jobs (hundreds) and I want at
the end to have in one log file the output and the error log of all the
jobs in the cluster. For the moment I am using the shell name and pid
for the log name ( $0.$$ ) but the pid will be reused and I will like to
use the cluster number for it - which should be unique (or not?).

Is there any way to get the cluster number in the script without having
to parse the output of the condor_submit command?

cluster=`condor_submit job.submit | grep "submitted to cluster" | awk
'{print $6} `
echo "cluster $cluster"

Regards,
Alexandru

_______________________________________________
Condor-users mailing list
To unsubscribe, send a message to condor-users-request@xxxxxxxxxxx with
a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/condor-users

The archives can be found at:
https://lists.cs.wisc.edu/archive/condor-users/