TABLE OF CONTENTS


::pwtk::queue::submit

SYNOPSIS

proc ::pwtk::queue::submit {queueSystem {file ""}} {

PURPOSE

A generic proc for submitting to the $queueSystem queuing system. An implementation of a specific queing system may define a custom submit routine, which is used if defined.

ARGUMENTS

SOURCE

    if { $file == {} } {
        set scriptName job.$queueSystem
    }
    fprint $queueSystem {*}$file

    if { $queueSystem eq "queue" } {
        # prevent an infinite recursive call to ::pwtk::queue::submit
        # with '::pwtk::queue::submit queue ?file?'
        return
    } elseif { [info procs ::pwtk::${queueSystem}::submit] ne {} } {

        # the submit command for $queueSystem is defined        
        ::pwtk::${queueSystem}::submit $file    
        
    } else {
        # a generic 'submit' recipe        
        variable queue
        
        ::pwtk::ifexist queue($queueSystem,submitCmd) {
            ::pwtk::print  "Running:   exec $queue($queueSystem,submitCmd) $queue($queueSystem,submitOpts) $file &"
            ::pwtk::print [::pwtk::try_exec -- {*}$queue($queueSystem,submitCmd) {*}$queue($queueSystem,submitOpts) $file &]

            # BEWARE: queue($queueSystem,submitOpt) are one-time options, reset them 
            set queue($queueSystem,submitOpts) {}
        } else {
            ::pwtk::error "cannot submit jobs because the '$queueSystem' queuing system was not initialized" 1
        }
    }
}