Mailing List Archives
Authenticated access
|
|
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Condor-users] I don't find condor_submit_dag
- Date: Thu, 5 May 2005 10:37:05 -0500 (CDT)
- From: "R. Kent Wenger" <wenger@xxxxxxxxxxx>
- Subject: Re: [Condor-users] I don't find condor_submit_dag
On Wed, 4 May 2005, Maria Teresa Gonzalez wrote:
> Hi!!
> I'm working with Condor to make an research project. I'm trying to use condor_submit_dag,
> but I can't find this script on folder instalation. I installed version 6.6.9
> in linux. I read that this version had this script, but it wasn't installed.
> Do you know what I can do?
>
> I really appreciate if you cand help me.
Hmm, we'll have to figure out if there's a problem with the tarball.
Anyhow, I've attached the condor_submit_dag script.
Kent Wenger
Condor Team
#!/usr/bin/env perl
###########################################################################
#
# This is condor_submit_dag. It takes a DAG input file to be used by
# condor_dagman, analyzes it for correctness and gleens important
# information. Then, it creates a file used to submit condor_dagman
# to Condor as a "meta-scheduler" with this DAG file. Finally,
# unless you specify the "-no_submit" option to condor_submit_dag, it
# actually submits this newly-created file to Condor, which spawns
# the condor_dagman binary on your local machine (and will restart it
# if the local machine crashes, etc).
#
# Other than setting the proper path to perl above, you should not
# need to edit this script at all.
#
# condor_submit_dag by Derek Wright <wright@xxxxxxxxxxx> 1/8/99
#
###########################################################################
print "\n";
# Parse command-line args
$dagman_path = "";
$submit = 1;
$force = 0;
$max_jobs = 0;
$max_pre = 0;
$max_post = 0;
$notification = "";
$NoPostFail = 0;
$dagman_debug = 3;
while( $_ = shift ) {
SWITCH: {
if( /^-no_s.*/i ) {
$submit = 0;
last SWITCH;
}
if( /^-v.*/i ) {
$verbose = 1;
last SWITCH;
}
if( /^-f.*/i ) {
$force = 1;
last SWITCH;
}
if( /^-not.*/i ) {
$notification = shift;
if( ! grep(/$notification/i, ("always", "complete", "error", "never")) ) {
print "Invalid argument to -notification option: $notification\n";
&usage();
}
last SWITCH;
}
if( /^-l.*/i ) {
$job_log = shift;
if( ! $job_log ) {
&usage();
}
last SWITCH;
}
if ( /^-dagman.*/i) {
$dagman_path = shift;
if ( ! $dagman_path ) {
&usage();
}
last SWITCH;
}
# -->DAP
if( /^-storklog.*/i ) {
$stork_log = shift;
if( ! $stork_log ) {
&usage();
}
last SWITCH;
}
if( /^-storkserver.*/i ) {
$stork_server = shift;
if( ! $stork_server ) {
&usage();
}
last SWITCH;
}
# <--DAP
if( /^-maxj.*/i ) {
$max_jobs = shift;
if( ! $max_jobs ) {
&usage();
}
if( !($max_jobs =~ /^\d+$/) ) {
print "ERROR: Invalid argument \"$max_jobs\" to -maxjobs.\n",
"You must specify a number.\n\n";
&usage();
}
last SWITCH;
}
if( /^-MaxPr.*/i ) {
$max_pre = shift;
if( ! $max_pre ) {
&usage();
}
if( !($max_pre =~ /^\d+$/) ) {
print "ERROR: Invalid argument \"$max_pre\" to -MaxPre.\n",
"You must specify a number.\n\n";
&usage();
}
last SWITCH;
}
if( /^-MaxPo.*/i ) {
$max_post = shift;
if( ! $max_post ) {
&usage();
}
if( !($max_post =~ /^\d+$/) ) {
print "ERROR: Invalid argument \"$max_post\" to -MaxPost.\n",
"You must specify a number.\n\n";
&usage();
}
last SWITCH;
}
if( /^-NoPostFail.*/i ) {
$NoPostFail = 1;
last SWITCH;
}
if( /^-r/i ) {
$remote_schedd = shift;
if( ! $remote_schedd ) {
&usage();
}
$remote_schedd = "-r $remote_schedd";
last SWITCH;
}
if( /^-d.*/i ) {
$dagman_debug = shift;
if( ! $dagman_debug ) {
&usage();
}
if( !($dagman_debug =~ /^\d+$/) ) {
print "ERROR: Invalid argument \"$dagman_debug\" to -debug.\n",
"You must specify a number.\n\n";
&usage();
}
last SWITCH;
}
$dagfile = $_;
}
}
if( ! $dagfile ) {
&usage();
} else {
# Setup some filenames we're going to want to use.
$lib_log = "$dagfile.lib.out";
$debug_log = "$dagfile.dagman.out";
$sched_log = "$dagfile.dagman.log";
$sub_file = "$dagfile.condor.sub";
$rescue_file = "$dagfile.rescue";
}
# See if there is an executable 'condor_dagman' anywhere in our path if it
# has not been defined on the command line
if ( $dagman_path eq "") {
foreach $dir ( split /:/, $ENV{PATH} )
{
$cur_path = "$dir/condor_dagman";
if( -x $cur_path ) {
$dagman_path = $cur_path;
last;
}
}
}
-x $dagman_path ||
die "Can't find the condor_dagman exectuable in your PATH, aborting.\n";
# Make sure all the files we're going to use are available, and if
# not, exit with an error message. If we were given "-force", don't
# print the error and exit, just remove them.
&check_output_files();
# Figure out what the log file should be called. If there are
# multiple log files mentioned, this function will abort. If we were
# told on the command-line, we just use that, and print a warning
# message. If we were told not to check the whole thing, we just read
# the first one out and use that.
if( $job_log ) {
print "Using \"$job_log\" as the log file shared by all jobs in this DAG.\n";
print "Please be sure you know what you're doing and that all jobs use this file.\n";
} else {
# With the new multi-log-reader code, DAGMan doesn't do much with
# this anyhow, but it complains if nothing is specified.
$job_log = "$dagfile.dummy_log";
}
# Create the submit file used to submit DAGMan as a scheduler universe
# job to Condor.
&write_submit_file();
# Print closing remarks, and actually submit the DAG if that's wanted.
print "-----------------------------------------------------------------------\n";
print "File for submitting this DAG to Condor : $sub_file\n";
print "Log of DAGMan debugging messages : $debug_log\n";
print "Log of Condor library debug messages : $lib_log\n";
print "Log of the life of condor_dagman itself : $sched_log\n";
print "\n";
if ( $job_log ){
print "Condor Log file for all Condor jobs of this DAG: $job_log\n";
}
# -->DAP
if ( $stork_log ){
print "Stork Log file for all DaP jobs of this DAG : $stork_log\n";
}
if ( $stork_server ){
print "Stork server to which DaP jobs will be submitted : $stork_server\n";
}
# <--DAP
if( $submit ) {
print `condor_submit $remote_schedd $sub_file`;
} else {
print "-no_submit given, not submitting DAG to Condor. You can do this with:\n";
print "\"condor_submit $sub_file\"\n";
}
print "-----------------------------------------------------------------------\n";
exit( 0 );
#################################################################
## Subroutines
#################################################################
sub usage {
print "Usage: condor_submit_dag [options] filename\n";
print " where filename is the name of your DAG input file\n";
print " and where [options] is one or more of:\n";
print " -dagman (Full path to an alternate condor_dagman executable)\n";
print " -no_submit (DAG is not submitted to Condor)\n";
print " -verbose (Verbose error messages from condor_submit_dag)\n";
print " -force (Overwrite files condor_submit_dag uses if they exist)\n";
print " -r schedd_name (Submit to the specified remote schedd)\n";
print " -maxjobs number (Maximum number of jobs ever submitted at once)\n";
print " -MaxPre number (Maximum number of PRE scripts to run at once)\n";
print " -MaxPost number (Maximum number of POST scripts to run at once)\n";
print " -NoPostFail (Don't run POST scripts after failed jobs)\n";
print " -log filename (Specify the Condor log file shared by all Condor jobs in the DAG)\n";
# -->DAP
print " -storklog filename (Specify the Stork log file shared by all DaP jobs in the DAG)\n";
print " -storkserver hostname (Specify the hostname to submit DaP jobs)\n";
# <--DAP
print " -notification value (Determines how much email you get from Condor)\n";
print " -debug number (Determines how verbosely DAGMan logs its work)\n";
print " about the life of the condor_dagman job. 'value' must be\n";
print " one of \"always\", \"never\", \"error\", or \"complete\".\n";
print " See the condor_submit man page for details.)\n";
exit( 1 );
}
sub write_submit_file {
local( $args );
open( SUBMIT, ">$sub_file" )
|| die "Can't open $sub_file for writing: $!\n";
print SUBMIT "# Filename: $sub_file\n";
print SUBMIT "# Generated by condor_submit_dag $dagfile\n";
print SUBMIT "universe\t= scheduler\n";
print SUBMIT "executable\t= $dagman_path\n";
print SUBMIT "getenv\t\t= True\n";
print SUBMIT "output\t\t= $lib_log\n";
print SUBMIT "error\t\t= $lib_log\n";
print SUBMIT "log\t\t= $sched_log\n";
print SUBMIT "remove_kill_sig\t= SIGUSR1\n";
$args = "-f -l . -Debug $dagman_debug -Lockfile $dagfile.lock";
$args = $args . " -Dag $dagfile";
$args = $args . " -Rescue $rescue_file";
# --> DAP
if( $job_log ){
$args = $args . " -Condorlog $job_log";
}
if( $stork_log ){
$args = $args . " -Storklog $stork_log";
}
if( $stork_server ){
$args = $args . " -Storkserver $stork_server";
}
# <-- DAP
if( $max_jobs ) {
$args = $args . " -MaxJobs $max_jobs";
}
if( $max_pre ) {
$args = $args . " -MaxPre $max_pre";
}
if( $max_post ) {
$args = $args . " -MaxPost $max_post";
}
if( $NoPostFail == 1 ) {
$args = $args . " -NoPostFail";
}
print SUBMIT "arguments\t= $args\n";
print SUBMIT "environment\t= _CONDOR_DAGMAN_LOG=$debug_log;_CONDOR_MAX_DAGMAN_LOG=0\n";
if( $notification ) {
print SUBMIT "notification\t= $notification\n";
}
print SUBMIT "queue\n";
close SUBMIT;
}
sub check_output_files {
local( $had_error ) = 0;
if( $force ) {
unlink( "$sub_file" );
unlink( "$debug_log" );
unlink( "$sched_log" );
unlink( "$lib_log" );
unlink( "$rescue_file" );
} else {
if( -f $sub_file ) {
$had_error = 1;
print "ERROR: \"$sub_file\" already exists.\n";
}
if( -f $lib_log ) {
$had_error = 1;
print "ERROR: \"$lib_log\" already exists.\n";
}
if( -f $debug_log ) {
$had_error = 1;
print "ERROR: \"$debug_log\" already exists.\n";
}
if( -f $sched_log ) {
$had_error = 1;
print "ERROR: \"$sched_log\" already exists.\n";
}
if( -f $rescue_file ) {
$had_error = 1;
print "ERROR: \"$rescue_file\" already exists.\n",
" You may want to resubmit your DAG using that file, instead of ",
"\"$dagfile\".\n",
" Look at the Condor manual for details about DAG rescue files.\n",
" Please investigate and either remove \"$rescue_file\",\n",
" or use that as the input to condor_submit_dag.\n";
}
if( $had_error ) {
print "\nSome file(s) needed by condor_submit_dag already exist. ";
print "Either rename them,\nor use the \"-f\" option to force them ";
print "to be overwritten.\n";
exit( 1 );
}
}
}