#!/usr/bin/env python # # This file sets up and runs a SAM project. # import os, sys, string, time, signal from re import * from globals import * import run_project ############################################################################ # # Set the following variables to appropriate values # Consult database for valid choices sam_station = "" ############################################# # This is the only place which needs to be # # modified ! # # # # Enter you data-set name here: # # # # Consult Database for valid choices # project_definition = "" ############################################# # A particular snapshot version, last or new snapshot_version = 'new' # Consult database for valid choices appname = "file-import" version = "1.00" group = "test" # The maximum number of files to get from sam max_file_amt = 4000 # for additional debug info use "--verbose" #verbosity = "--verbose" verbosity = "" # Give up on all exceptions give_up = 1 def file_ready(filename): # Replace this python subroutine with whatever you want to do # to process the file that was retrieved. # Your program will only be called in the event of # a successful delivery. # filename = os.path.split(filename)[1] print "--> got file: ", filename # print("DUMP PROJECT:") # dumpProject() # # print("DUMP CONSUMER:") # dumpConsumer() os.system('sam lock file --file=%s --node= --group="test" '%filename) return ############################################################################ ############################################################################ def begin_project(): print("MY PROJECT: into begin_project, do what needs to be done BEFORE file_ready().") print("\tProject Name = %s" % getProjectName()) print("\tConsumer ID = %s" % getConsumerId()) print("\tConsumer Process ID = %s" % getConsumerProcessId()) global processedFileCount processedFileCount = 0 return def end_project(): global processedFileCount print("MY PROJECT: into end_project, do what needs to be done AFTER all files are delivered/processed.") print("MY PROJECT saw %s files." % processedFileCount) return def abort_project(): global processedFileCount print("MY PROJECT: EARLY ABORT, after processing %s files." % processedFileCount) print("DUMP PROJECT:") dumpProject() print("DUMP CONSUMER:") dumpConsumer() return