Esempio n. 1
0
                    required=True,
                    help='string, Executable')

parser.add_argument('-c',
                    '--config',
                    type=str,
                    dest='cfg',
                    help='string, Config file',
                    required=True)

args = parser.parse_args()

#
# Sanity checks
#
t = table(args.inputproject)
njobs = 0
if not t.exist():
    print 'ERROR: Project does not exist:', args.inputproject
    sys.exit(1)
njobs = t.count_jobs()

if not njobs:
    print 'ERROR: No job from input project:', args.inputproject
    sys.exit(1)
if not os.path.isfile(args.exe):
    print 'ERROR: Executable does not exist:', args.exe
    sys.exit(1)
else:
    s = os.stat(args.exe)
    if not (s.st_mode & stat.S_IEXEC):
Esempio n. 2
0
from proddb.table import table
import sys

t = table('test_removeme')

# test creation
t.create()
if not t.exist():
    print 'Failed creation'
    sys.exit(1)
t.drop()
t.create()

t.fill('aho_000.root', 0)
t.fill('aho_001.root', 1)

assert len(t.list()) == 2
assert len(t.list(session_id=0)) == 1
assert len(t.list(status=1)) == 2
assert len(t.list(job_index=0)) == 0
assert len(t.list(job_index=-1)) == 2
assert len(t.list(lock=True)) == 0
assert len(t.list(lock=False)) == 2
assert len(t.unique_sessions(sequence=0)) == 2
assert len(t.unique_sessions(sequence=1)) == 0
assert len(t.unique_sessions()) == 2

t.reset_job_index(status=1)
assert len(t.list(job_index=0)) == 1
assert len(t.list(job_index=1)) == 1
assert len(t.list(job_index=-1)) == 0
Esempio n. 3
0
#!/usr/bin/env python
from proddb.table import table
import sys

if not len(sys.argv) in [2,3]:
    print 'Usage: %s PROJECT_NAME' % sys.argv[0]
    sys.exit(1)

project_name = sys.argv[1]
t=table(project_name)

if not t.exist():
    print 'Error: project does not exist:',project_name
    sys.exit(1)

if t.is_locked():
    print 'Error: project is locked!'
    sys.exit(1)

t.drop()

Esempio n. 4
0
#!/usr/bin/env python
from proddb.table import table
from proddb.dbenv import *
import sys, commands, os
from subprocess import Popen, PIPE

in_project = sys.argv[1]
t = table(in_project)
if not t.exist():
    print 'Project does not exist:', sys.argv[1]
    sys.exit(1)
jobid = int(sys.argv[2])
session = t.job_session(job_index=jobid)
t.update_job_status(status=kSTATUS_RUNNING, job_index=jobid)
#
# Sleep for sometime to avoid simultaneous execution across all jobs
#
import time
time.sleep(jobid % 60)

config = sys.argv[3]
storage = sys.argv[4]
out_project = ''
if len(sys.argv) > 5:
    out_project = sys.argv[5]

if not os.path.isdir(storage):
    print 'Not present:', storage
    sys.exit(1)
if not os.path.isfile(config):
    print 'Not present:', config
Esempio n. 5
0
#!/usr/bin/env python
from proddb.table import table
from proddb.dbenv import *
import sys, commands, os
from subprocess import Popen, PIPE

in_project1 = sys.argv[1]
in_project2 = sys.argv[2]
t1 = table(in_project1)
if not t1.exist():
    print 'Project does not exist:', sys.argv[1]
    sys.exit(1)
t2 = table(in_project2)
if not t2.exist():
    print 'Project does not exist:', sys.argv[2]
    sys.exit(1)
jobid = int(sys.argv[4])
session = t1.job_session(job_index=jobid)

t1.update_job_status(status=kSTATUS_RUNNING, job_index=jobid)
t2.update_job_status(status=kSTATUS_RUNNING, job_index=jobid)
#
# Sleep for sometime to avoid simultaneous execution across all jobs
#
import time

time.sleep(jobid % 60)

config = sys.argv[3]
storage = sys.argv[5]
out_project = ''
Esempio n. 6
0
    sys.exit(0)

project = ''
while not project:
    sys.stdout.write('Define a project name: ')
    sys.stdout.flush()
    project=sys.stdin.readline().strip('\n')
    
try:
    from proddb.table import table
except ImportError:
    'You do not have proddb. Check $LARCV_BASEDIR/python dir.'
    sys.exit(1)

from proddb.table import table
t=table(project)
if t.exist():
    user_input = ''
    while not user_input:
        sys.stdout.write('Project name already exists. Want to really use it? [y/n]: ')
        sys.stdout.flush()
        user_input=sys.stdin.readline().strip('\n')
        if not user_input in ['y','yes','n','no']:
            user_input = ''
else:
    t.create()
if user_input in ['n','no']:
    sys.exit(0)

keys=good_files.keys()
keys.sort()
Esempio n. 7
0
#!/usr/bin/env python
import sys,os
from proddb.table import table

if not len(sys.argv) <4:
    print 'USAGE: %s PROJECT_NAME SESSION_ID [FILE1 FILE2 ...]' % sys.argv[0]
    sys.exit(1)
if not sys.argv[2].isdigit():
    print 'Session ID must be integer...'
    sys.exit(1)

t=table(sys.argv[1])
if not t.exist():
    t.create()

session = int(sys.argv[2])

files=sys.argv[3:]
for f in files:
    if not os.path.isfile(f):
        print 'File not found:',f
        sys.exit(1)
    
t.register_session(file_v = files, check=False)




Esempio n. 8
0
                    required=True,
                    help='string, Executable')

parser.add_argument('-c',
                    '--config',
                    type=str,
                    dest='cfg',
                    help='string, Config file',
                    required=True)

args = parser.parse_args()

#
# Sanity checks
#
t1 = table(args.inputproject1)
if not t1.exist():
    print 'ERROR: Project does not exist:', args.inputproject1
    sys.exit(1)

t2 = table(args.inputproject2)
if not t2.exist():
    print 'ERROR: Project does not exist:', args.inputproject2
    sys.exit(1)

if t1.count_jobs() != t2.count_jobs():
    msg = 'ERROR: two projects have different number of jobs! (%s @ %d vs. %s @ %d)'
    msg = msg % (args.inputproject1, t1.count_jobs(), args.inputproject2,
                 t2.count_jobs())
    print msg
    sys.exit(1)