#!/usr/bin/env python import string import types import BatchCommand import BatchQueue import BatchAdapter import BatchAdapterManager ############################################################################## # Adapter definitions. StationName_ = "cdf-oxford" BatchAdapterList_ = [] ###################################################################### # Batch command definitions. batchCommandResult_1 = BatchCommand.BatchCommandResult(0, "", "Success") batchCommandResult_2 = BatchCommand.BatchCommandResult(1, "", "Failure") batchCommand_1 = BatchCommand.BatchCommand("job kill command", "${SAM_BATCH_ADAPTER_CONFIG_DIR}/sam_pbs_handler.sh job_kill --project=%__USER_PROJECT__ --local-job-id=%__BATCH_JOB_ID__", [batchCommandResult_1, batchCommandResult_2, ]) batchCommandResult_1 = BatchCommand.BatchCommandResult(0, "", "Success") batchCommandResult_2 = BatchCommand.BatchCommandResult(0, "JobId=%__BATCH_JOB_ID__ Status=%__BATCH_JOB_STATUS__", "") batchCommandResult_3 = BatchCommand.BatchCommandResult(1, "", "Failure") batchCommand_2 = BatchCommand.BatchCommand("job lookup command", "${SAM_BATCH_ADAPTER_CONFIG_DIR}/sam_pbs_handler.sh job_lookup --project=%__USER_PROJECT__ --local-job-id=%__BATCH_JOB_ID__", [batchCommandResult_1, batchCommandResult_2, batchCommandResult_3, ]) batchCommandResult_1 = BatchCommand.BatchCommandResult(0, "", "Success") batchCommandResult_2 = BatchCommand.BatchCommandResult(0, "%__BATCH_JOB_ID__", "") batchCommandResult_3 = BatchCommand.BatchCommandResult(1, "", "Failure") batchCommand_3 = BatchCommand.BatchCommand("job submit command", "${SAM_BATCH_ADAPTER_CONFIG_DIR}/sam_pbs_handler.sh job_submit --project=%__USER_PROJECT__ --executable=%__USER_SCRIPT__ --stdout=%__USER_JOB_OUTPUT__ --stderr=%__USER_JOB_ERROR__", [batchCommandResult_1, batchCommandResult_2, batchCommandResult_3, ]) ###################################################################### # Batch queue definitions. batchQueue_1 = BatchQueue.ConsumerQueue("L", "", {}) ###################################################################### # Batch adapter definition. batchAdapter_1 = BatchAdapter.BatchAdapter([batchCommand_1, batchCommand_2, batchCommand_3, ], [batchQueue_1, ], {}, "grid", "", { } ) BatchAdapterList_.append(batchAdapter_1) ############################################################################## # Batch adapter manager. def getBatchAdapterManager(): # There should be only one per station. try: batchAdapterManager = BatchAdapterManager.BatchAdapterManager( BatchAdapterList_, StationName_) except BatchAdapterManager.BatchAdapterManager, bam: batchAdapterManager = bam return batchAdapterManager ############################################################################## # Unit tests. if ( __name__ == "__main__" ): pass