Newer
Older
Analysis / ganga / Lb2Lcmunu / get_big_outputs.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Elena Graverini
# @Date:   2016-01-22 10:31:34
# @Last Modified by:   Elena Graverini
# @Last Modified time: 2016-01-22 10:51:22
import os
pwd = os.getcwd()
os.chdir('/disk/users/elena/Lb2Lcmunu/ntuples/OUTPUTS')
myjobs = jobs.select(261, 264)
total = 0
failed = 0
complete_to_download = 0
completed = 0
completed_with_errors = 0
l_total = []
l_failed = []
l_complete_to_download = []
l_completed = []
l_completed_with_errors = []

os.system('/cvmfs/lhcb.cern.ch/lib/lhcb/LBSCRIPTS/LBSCRIPTS_v8r5p1/InstallArea/scripts/SetupProject.sh LHCbDirac')
os.system('/cvmfs/lhcb.cern.ch/lib/lhcb/LHCBDIRAC/LHCBDIRAC_v8r2p27/scripts/lhcb-proxy-init')

for (index, j) in enumerate(myjobs):
    for sj in j.subjobs:
        total += 1
        l_total.append((j.id, sj.id))
        if (sj.status == "failed"):
            if (sj.backend.status == 'Completed') and ('Successfully' in sj.backend.statusInfo):
                complete_to_download += 1
                l_complete_to_download.append((j.id, sj.id))
            else:
                failed += 1
                l_failed.append((j.id, sj.id))
        elif (sj.status == 'completed'):
            if 'Errors' in sj.backend.statusInfo:
                completed_with_errors += 1
                l_completed_with_errors.append((j.id, sj.id))
            else:
                completed += 1
                l_completed.append((j.id, sj.id))

print 'total SJ:', total
print 'failed SJ:', failed
print 'completed with errors:', completed_with_errors
print 'failed to download:', complete_to_download
print 'completed:', completed
os.chdir(pwd)