TABLE OF CONTENTS


::pwtk::queue::init

SYNOPSIS

proc ::pwtk::queue::init {queueSystem queueSubmitCmd queueDirectiveString} {

PURPOSE

Initialization of a batch queuing support for the $queueSystem. It initializes the variables and creates ${queueSystem}_*** flavor of commands.

A given implementation of a queuing system must define it's own 'init' proc (for an implementation, see ::pwtk::slurm::init). Additionally, it may also define the ::pwtk::${queueSystem}::parseOptions_ proc.

ARGUMENTS

SOURCE

    variable queue    
    variable profile
    variable pwtk_profile

    set queue($queueSystem,directive) $queueDirectiveString
    set queue($queueSystem,submitCmd) $queueSubmitCmd
    set queue($queueSystem,submitOpts) {}
    
    foreach part {profile head pwtk tail} {
        ::pwtk::ifset queue($queueSystem,$part) {}
    }
                            
    # define the short-cut ${queueSystem}_*** commands
    
    set QUEUE [string toupper $queueSystem]

    if { [info procs ::pwtk::${queueSystem}_head] eq {} } {
        proc ::pwtk::${QUEUE} {args} "uplevel ::pwtk::queue::QUEUE $queueSystem \$args"

        foreach sep {:: _} {
            proc ::pwtk::${queueSystem}${sep}head  {args} [concat ::pwtk::queue::head $queueSystem \{*\}\$args]
            proc ::pwtk::${queueSystem}${sep}tail  {args} [concat ::pwtk::queue::tail $queueSystem \{*\}\$args]
        
            proc ::pwtk::${queueSystem}${sep}get    {{profileName {}}} [concat ::pwtk::queue::get $queueSystem \{*\}\$profileName]
            proc ::pwtk::${queueSystem}${sep}clear  {} [list ::pwtk::queue::clear $queueSystem]
            proc ::pwtk::${queueSystem}${sep}fprint {{file {}}} [concat ::pwtk::queue::fprint $queueSystem \{*\}\$file]

            proc ::pwtk::${queueSystem}${sep}profile {profileName {queueSpecs {}} {pwtkSpecs {}}} \
                [concat ::pwtk::queue::profile $queueSystem \$profileName \$queueSpecs \$pwtkSpecs]
            proc ::pwtk::${queueSystem}${sep}profileDefault {profileName} \
                [concat ::pwtk::queue::profileDefault $queueSystem \$profileName]       
            proc ::pwtk::${queueSystem}${sep}pwtk_profile {profileName {pwtkSpecs {}}} \
                [concat ::pwtk::queue::pwtk_profile $queueSystem \$profileName \$pwtkSpecs]
            proc ::pwtk::${queueSystem}${sep}pwtk_profileDefault {profileName} \
                [concat ::pwtk::queue::pwtk_profileDefault $queueSystem \$profileName]
        }
        foreach cmd {
            head
            tail       
            get 
            clear
            fprint

            profile
            profileDefault
            pwtk_profile
            pwtk_profileDefault
        } {
            namespace eval ::pwtk namespace export ${queueSystem}_$cmd
            namespace eval :: namespace import ::pwtk::${queueSystem}_$cmd
        }
    }
}