def gt_queue_clone(request, queue_id): ''' Clone an existing queue and its entries via GTQueueManager class ''' gt_queue_obj = get_object_or_404(GTQueue, pk=queue_id) cloned_queue_obj = GTQueueManager(gt_queue_obj).queue_clone() return HttpResponseRedirect( reverse('gt_queue_edit', kwargs={'queue_id': cloned_queue_obj.id}))
def gt_queue_entry_multiple_status_change(request, gt_queue_id, new_status): ''' Queue entries multiple status change ''' entry_status_filter = request.GET.get('entry_status_filter', '') queue_pending_entries = GTQueueEntry.objects.filter(queue_id=gt_queue_id, status='P') if queue_pending_entries: for e in queue_pending_entries: gt_queue_entry = get_object_or_404(GTQueueEntry, pk=e.id) queue = gt_queue_entry.queue change_results = GTQueueManager(queue).change_queue_entry_status( gt_queue_entry, new_status, request.user) queue_entry_obj, affected_records, old_status, old_status_display = change_results reports.report_queue_entry_status_changed(queue_entry_obj, affected_records, old_status, old_status_display) messages.add_message( request, messages.INFO, "Queue entry with record name " + gt_queue_entry.record.name + " changed multiple entries status to " + new_status) return HttpResponseRedirect( reverse('gt_queue_entries', kwargs={'queue_id': gt_queue_id}) + "?entry_status_filter=" + entry_status_filter)
def gt_conf_export(request, gt_queue_name): queue = get_object_or_404(GTQueue, name=gt_queue_name) response_text = GTQueueManager(queue).queue_configuration() filename = queue.expected_gt_name + ".conf" response = HttpResponse(response_text) response['Content-Disposition'] = 'attachment; filename=' + filename return response
def save(self): #TODO if was errors with commit_on_success(): gt_obj, created = GlobalTag.objects.get_or_create(name=self.name) if not gt_obj.has_errors: raise Exception("Trying to save already correctly saved GT") #print self.name, "was created: ", created gt_obj.has_errors = self.has_errors() if self.has_errors(): gt_obj.errors = json.dumps(self.entries_with_errors_dict(), indent=4) else: gt_obj.errors = "" gt_obj.has_warnings = self.has_warnings() if self.has_warnings(): gt_obj.warnings = json.dumps(self.entries_ignored_dict(), indent=4) else: gt_obj.warnings = "" gt_obj.save() if not self.has_errors(): self._set_children_gt(gt_obj) valid_entries = self.valid_entry_objects(gt_obj) new_valid = [] for e in range(0, len(valid_entries)): obj_exists = GlobalTagRecord.objects.filter( global_tag_id=valid_entries[e].global_tag, tag_id=valid_entries[e].tag, record_id=valid_entries[e].record, label=valid_entries[e].label) if obj_exists: obj_exists = False else: new_valid.append(valid_entries[e]) valid_entries = new_valid for i in range(0, len(valid_entries), 50): GlobalTagRecord.objects.bulk_create(valid_entries[i:i + 50]) try: gt_queue_obj = GTQueue.objects.get( expected_gt_name=gt_obj.name) GTQueueManager(gt_queue_obj).update_queue_from_gt(gt_obj) except GTQueue.DoesNotExist: pass
def gt_queue_create(request): if request.method == 'POST': gt_queue_form = GTQueueModelForm(request.POST) if gt_queue_form.is_valid(): with transaction.commit_on_success(): gt_queue_obj = gt_queue_form.save() GTQueueManager(gt_queue_obj).create_children(request.user) logger.info("Preparing for report") report_queue_created(gt_queue_obj) logger.info("Report should be sent") return HttpResponseRedirect( reverse('gt_queue_list')) # Redirect after POST else: gt_queue_form = GTQueueModelForm() return render_to_response("admin2/gt_queue_create.html", {"gt_queue_form": gt_queue_form}, context_instance=RequestContext(request))
def gt_queue_entry_status_change(request, gt_queue_entry_id, new_status): gt_queue_entry = get_object_or_404(GTQueueEntry, pk=gt_queue_entry_id) entry_status_filter = request.GET.get('entry_status_filter', '') queue = gt_queue_entry.queue change_results = GTQueueManager(queue).change_queue_entry_status( gt_queue_entry, new_status, request.user) #TODO needed GTQueueEntryManager queue_entry_obj, affected_records, old_status, old_status_display = change_results reports.report_queue_entry_status_changed(queue_entry_obj, affected_records, old_status, old_status_display) messages.add_message( request, messages.INFO, "Queue entry with with record name " + gt_queue_entry.record.name + "changed status to " + new_status) return HttpResponseRedirect( reverse('gt_queue_entries', kwargs={'queue_id': queue.id}) + "?entry_status_filter=" + entry_status_filter)
def handle(self, *args, **options): # ---++ START52 # ---++++!! Approved # #%TABLE{ tableborder="0" cellpadding="4" cellspacing="3" cellborder="1" headerbg="#D5CCB1" headercolor="#666666" databg="#FAF0D4, #F3DFA8" headerrows="1" dataalign="left"}% #%EDITTABLE{ format="| text, -1 | text, -1 | text, -1 | text, -1 | text, -1 | label, 0, %SERVERTIME{"$day/$mon/$year"}% | text, -1 | "changerows="on"}% # | *Tag name* | *Record name* | *Label* | *Database account* | *Brief description* | *posted* | *GT* | start_52_data_text = """ | !AlCaRecoHLTpaths5e32_v16_mc | !AlCaRecoTriggerBitsRcd | | CMS_COND_31X_HLT | It contains latest changes in 5E33 2012 HLT Menu /dev/CMSSW_5_2_0/HLT/V30: AlCa_EcalEta_v* -> AlCa_EcalEta*, AlCa_EcalPi0_v* -> AlCa_EcalPi0*. Removed non existing CSC bits | 15/Mar/2012 | | | !DTt0_STARTUP_V02_mc | !DTT0Rcd | | CMS_COND_DT_000 | Migration to new account | 19/Mar/2012 | | | !DTTtrig_V01_cosmics_mc | !DTTtrigRcd | cosmics | CMS_COND_31X_DT | New cosmics DTTtrig MC tag | 23/Mar/2012 | | | !CSCBadChambers_March2012_v1_mc | !CSCBadChambersRcd | | CMS_COND_31X_CSC | new tag for CSC Bad Chambers for inclusion in the GT for the 5_2_X ReDigi/ReReco of MC: -- Chamber status changes -- ME-1/1/02 [Now Bad] ME-1/1/22 [Now Bad] ME-1/1/32 [Now Bad] ME+1/1/06 [Now Bad] ME+1/1/03 [Now Good] ME+1/1/24 [Now Good] | 27/Mar/2012 | | | !HcalChannelQuality_v1.40_mc | !HcalChannelQualityRcd | | !CMS_COND_31X_HCAL | Updated channel status, HO ring2 is now on | 29/Mar/2012 | START52_V7 | | !L1EmEtScale_EEG_EHSUMS_TAU4_FGHOE_CALIBV4_15MAR12_mc | !L1EmEtScaleRcd | | CMS_COND_31X_L1T | New !RCT configuration for 2012 running. | 27/Mar/2012 | START52_V8 | | !L1RCTParameters_EEG_EHSUMS_TAU4_FGHOE_CALIBV4_15MAR12_mc | !L1RCTParametersRcd | | CMS_COND_31X_L1T | New !RCT configuration for 2012 running. | 27/Mar/2012 | START52_V8 | | !L1CaloHcalScale_EEG_EHSUMS_TAU4_FGHOE_CALIBV4_15MAR12_mc | !L1CaloHcalScaleRcd | | CMS_COND_31X_L1T | New !RCT configuration for 2012 running. | 27/Mar/2012 | START52_V8 | | !L1CaloEcalScale_EEG_EHSUMS_TAU4_FGHOE_CALIBV4_15MAR12_mc | !L1CaloEcalScaleRcd | | CMS_COND_31X_L1T | New !RCT configuration for 2012 running. | 27/Mar/2012 | START52_V8 | | !L1MuCSCTFConfiguration_10412_mc | !L1MuCSCTFConfigurationRcd | | CMS_COND_31X_L1T | New !CSCTF configuration for 2012 running | 01/Apr/2012 | START52_V8 | | !L1MuCSCPtLut_key-10_mc | !L1MuCSCPtLutRcd | | CMS_COND_31X_L1T | New !CSCTF configuration for 2012 running | 02/Apr/2012 | START52_V8 | | !L1MuGMTParameters_gmt2012_0_EarlyRPC_mc | !L1MuGMTParametersRcd | | CMS_COND_31X_L1T | New !GMT configuration for 2012 running | 02/Apr/2012 | START52_V8 | | !SiStripBadComponents_realisticMC_for2012_v1_mc | !SiStripBadChannelRcd | | CMS_COND_31X_STRIP | Added 12 new masked modules in TIB and TOB | 02/Apr/2012 | START52_V9 | | !L1CaloEcalScale_EEG_EHSUMS_TAU4_FGHOE_CALIBV1_02APR12_mc | !L1CaloEcalScaleRcd | | CMS_COND_31X_L1T | Corrected !RCT for ECAL transparency calibration in MC, not data | 02/Apr/2012 | START52_V9 | | !L1CaloHcalScale_EEG_EHSUMS_TAU4_FGHOE_CALIBV1_02APR12_mc | !L1CaloHcalScaleRcd | | CMS_COND_31X_L1T | Corrected !RCT for ECAL transparency calibration in MC, not data | 02/Apr/2012 | START52_V9 | | !L1EmEtScale_EEG_EHSUMS_TAU4_FGHOE_CALIBV1_02APR12_mc | !L1EmEtScaleRcd | | CMS_COND_31X_L1T | Corrected !RCT for ECAL transparency calibration in MC, not data | 02/Apr/2012 | START52_V9 | | !L1RCTParameters_EEG_EHSUMS_TAU4_FGHOE_CALIBV1_02APR12_mc | !L1RCTParametersRcd | | CMS_COND_31X_L1T | Corrected !RCT for ECAL transparency calibration in MC, not data | 02/Apr/2012 | START52_V9 | | Realistic8TeV2012Collisions_START52_V9_v1_mc | BeamSpotObjectsRcd | | CMS_COND_31X_BEAMSPOT | Updated 8TeV with the observed value of sigmaZ - for special MC productions only | 20/May/2012 | START52_V9A | """ entries_52 = self.data_to_information(start_52_data_text) GTQueue.objects.filter(expected_gt_name="START52_V9A").delete() GlobalTag.objects.filter(name="START52_V9A").delete() gt_queue_obj = GTQueue( name="START52_V9A", description="Test description", is_open=True, last_gt=GlobalTag.objects.get(name="START52_V7"), gt_type_category=GTTypeCategory.objects.get(name="mc"), gt_account=GTAccount.objects.get(name="base global tag account"), release_from=SoftwareRelease.objects.all().order_by("internal_version")[0], release_to=None, expected_gt_name="START52_V9A", ) print "queue created" gt_queue_obj.save() user, created = User.objects.get_or_create(username="******") print "dummy user created" queue_manager = GTQueueManager(gt_queue_obj) queue_manager.create_children(user) # -------- print entries_52 for data_entry in entries_52: # offline production tag = Tag.objects.get( name=data_entry["tag_name"], account__name=data_entry["db_acc"], account__account_type__title="Offline Production", ) record = Record.objects.get(name=data_entry["record_name"]) queue_manager.add_queue_entry( tag_obj=tag, record_obj=record, label=data_entry["label"], comment=data_entry["description"], submitter=user, status="A", ) # -------- # extra info tag = Tag.objects.get( name="EcalSampleMask_mc", account__name="CMS_COND_ECAL_000", account__account_type__title="Offline Production", ) record = Record.objects.get(name="EcalSampleMaskRcd") queue_manager.add_queue_entry( tag_obj=tag, record_obj=record, label="", comment="No description", submitter=user, status="A" ) tag = Tag.objects.get( name="DQM_RefHisto_dummy", account__name="CMS_COND_42X_DQM", account__account_type__title="Offline Production", ) record = Record.objects.get(name="GeometryFileRcd") queue_manager.add_queue_entry( tag_obj=tag, record_obj=record, label="", comment="No description", submitter=user, status="A" ) # ------- f = open(gt_queue_obj.expected_gt_name + ".conf_0", "wb") f.write(queue_manager.queue_configuration()) f.close() GlobalTagsUpdate()._process_global_tag("START52_V9A") f = open(gt_queue_obj.expected_gt_name + ".conf", "wb") f.write(queue_manager.queue_configuration()) f.close()
def handle(self, *args, **options): #---++ START52 #---++++!! Approved # #%TABLE{ tableborder="0" cellpadding="4" cellspacing="3" cellborder="1" headerbg="#D5CCB1" headercolor="#666666" databg="#FAF0D4, #F3DFA8" headerrows="1" dataalign="left"}% #%EDITTABLE{ format="| text, -1 | text, -1 | text, -1 | text, -1 | text, -1 | label, 0, %SERVERTIME{"$day/$mon/$year"}% | text, -1 | "changerows="on"}% #| *Tag name* | *Record name* | *Label* | *Database account* | *Brief description* | *posted* | *GT* | start_52_data_text =""" | !AlCaRecoHLTpaths5e32_v16_mc | !AlCaRecoTriggerBitsRcd | | CMS_COND_31X_HLT | It contains latest changes in 5E33 2012 HLT Menu /dev/CMSSW_5_2_0/HLT/V30: AlCa_EcalEta_v* -> AlCa_EcalEta*, AlCa_EcalPi0_v* -> AlCa_EcalPi0*. Removed non existing CSC bits | 15/Mar/2012 | | | !DTt0_STARTUP_V02_mc | !DTT0Rcd | | CMS_COND_DT_000 | Migration to new account | 19/Mar/2012 | | | !DTTtrig_V01_cosmics_mc | !DTTtrigRcd | cosmics | CMS_COND_31X_DT | New cosmics DTTtrig MC tag | 23/Mar/2012 | | | !CSCBadChambers_March2012_v1_mc | !CSCBadChambersRcd | | CMS_COND_31X_CSC | new tag for CSC Bad Chambers for inclusion in the GT for the 5_2_X ReDigi/ReReco of MC: -- Chamber status changes -- ME-1/1/02 [Now Bad] ME-1/1/22 [Now Bad] ME-1/1/32 [Now Bad] ME+1/1/06 [Now Bad] ME+1/1/03 [Now Good] ME+1/1/24 [Now Good] | 27/Mar/2012 | | | !HcalChannelQuality_v1.40_mc | !HcalChannelQualityRcd | | !CMS_COND_31X_HCAL | Updated channel status, HO ring2 is now on | 29/Mar/2012 | START52_V7 | | !L1EmEtScale_EEG_EHSUMS_TAU4_FGHOE_CALIBV4_15MAR12_mc | !L1EmEtScaleRcd | | CMS_COND_31X_L1T | New !RCT configuration for 2012 running. | 27/Mar/2012 | START52_V8 | | !L1RCTParameters_EEG_EHSUMS_TAU4_FGHOE_CALIBV4_15MAR12_mc | !L1RCTParametersRcd | | CMS_COND_31X_L1T | New !RCT configuration for 2012 running. | 27/Mar/2012 | START52_V8 | | !L1CaloHcalScale_EEG_EHSUMS_TAU4_FGHOE_CALIBV4_15MAR12_mc | !L1CaloHcalScaleRcd | | CMS_COND_31X_L1T | New !RCT configuration for 2012 running. | 27/Mar/2012 | START52_V8 | | !L1CaloEcalScale_EEG_EHSUMS_TAU4_FGHOE_CALIBV4_15MAR12_mc | !L1CaloEcalScaleRcd | | CMS_COND_31X_L1T | New !RCT configuration for 2012 running. | 27/Mar/2012 | START52_V8 | | !L1MuCSCTFConfiguration_10412_mc | !L1MuCSCTFConfigurationRcd | | CMS_COND_31X_L1T | New !CSCTF configuration for 2012 running | 01/Apr/2012 | START52_V8 | | !L1MuCSCPtLut_key-10_mc | !L1MuCSCPtLutRcd | | CMS_COND_31X_L1T | New !CSCTF configuration for 2012 running | 02/Apr/2012 | START52_V8 | | !L1MuGMTParameters_gmt2012_0_EarlyRPC_mc | !L1MuGMTParametersRcd | | CMS_COND_31X_L1T | New !GMT configuration for 2012 running | 02/Apr/2012 | START52_V8 | | !SiStripBadComponents_realisticMC_for2012_v1_mc | !SiStripBadChannelRcd | | CMS_COND_31X_STRIP | Added 12 new masked modules in TIB and TOB | 02/Apr/2012 | START52_V9 | | !L1CaloEcalScale_EEG_EHSUMS_TAU4_FGHOE_CALIBV1_02APR12_mc | !L1CaloEcalScaleRcd | | CMS_COND_31X_L1T | Corrected !RCT for ECAL transparency calibration in MC, not data | 02/Apr/2012 | START52_V9 | | !L1CaloHcalScale_EEG_EHSUMS_TAU4_FGHOE_CALIBV1_02APR12_mc | !L1CaloHcalScaleRcd | | CMS_COND_31X_L1T | Corrected !RCT for ECAL transparency calibration in MC, not data | 02/Apr/2012 | START52_V9 | | !L1EmEtScale_EEG_EHSUMS_TAU4_FGHOE_CALIBV1_02APR12_mc | !L1EmEtScaleRcd | | CMS_COND_31X_L1T | Corrected !RCT for ECAL transparency calibration in MC, not data | 02/Apr/2012 | START52_V9 | | !L1RCTParameters_EEG_EHSUMS_TAU4_FGHOE_CALIBV1_02APR12_mc | !L1RCTParametersRcd | | CMS_COND_31X_L1T | Corrected !RCT for ECAL transparency calibration in MC, not data | 02/Apr/2012 | START52_V9 | | Realistic8TeV2012Collisions_START52_V9_v1_mc | BeamSpotObjectsRcd | | CMS_COND_31X_BEAMSPOT | Updated 8TeV with the observed value of sigmaZ - for special MC productions only | 20/May/2012 | START52_V9A | """ entries_52 = self.data_to_information(start_52_data_text) GTQueue.objects.filter(expected_gt_name='START52_V9A').delete() GlobalTag.objects.filter(name="START52_V9A").delete() gt_queue_obj = GTQueue( name="START52_V9A", description="Test description", is_open = True, last_gt = GlobalTag.objects.get(name="START52_V7"), gt_type_category = GTTypeCategory.objects.get(name="mc"), gt_account = GTAccount.objects.get(name="base global tag account"), release_from = SoftwareRelease.objects.all().order_by('internal_version')[0], release_to = None, expected_gt_name = 'START52_V9A' ) print "queue created" gt_queue_obj.save() user, created = User.objects.get_or_create(username="******") print "dummy user created" queue_manager = GTQueueManager(gt_queue_obj) queue_manager.create_children(user) #-------- print entries_52 for data_entry in entries_52: #offline production tag = Tag.objects.get(name=data_entry["tag_name"], account__name=data_entry["db_acc"], account__account_type__title="Offline Production") record = Record.objects.get(name=data_entry["record_name"]) queue_manager.add_queue_entry(tag_obj=tag, record_obj=record,label=data_entry["label"], comment=data_entry["description"], submitter=user, status="A") #-------- #extra info tag = Tag.objects.get(name="EcalSampleMask_mc", account__name="CMS_COND_ECAL_000", account__account_type__title="Offline Production") record = Record.objects.get(name="EcalSampleMaskRcd") queue_manager.add_queue_entry(tag_obj=tag, record_obj=record,label="", comment="No description", submitter=user, status="A") tag = Tag.objects.get(name="DQM_RefHisto_dummy", account__name="CMS_COND_42X_DQM", account__account_type__title="Offline Production") record = Record.objects.get(name="GeometryFileRcd") queue_manager.add_queue_entry(tag_obj=tag, record_obj=record,label="", comment="No description", submitter=user, status="A") #------- f = open(gt_queue_obj.expected_gt_name + ".conf_0","wb") f.write(queue_manager.queue_configuration()) f.close() GlobalTagsUpdate()._process_global_tag('START52_V9A') f = open(gt_queue_obj.expected_gt_name + ".conf","wb") f.write(queue_manager.queue_configuration()) f.close()
def handle(self, *args, **options): print GTQueueManager().queue_configuration( GTQueue.objects.get(name="START52_V9_K1"))