Esempio n. 1
0
def other_sign_off_request():
    """
    send out general and acis sign off request email
    input:  none, but read from updates_table list
    output: email sent out
    """
    #
    #--- extract entries which general column is not signed off
    #
    entries = oda.select_non_signed_off('general')
    obs_list = create_obs_list(entries)
    address = "[email protected],[email protected],[email protected]"
    text = "This message is a weekly summary of obsid.revs which need general (non-ACIS) changes:\n\n"
    send_sign_off_email(obs_list, address, text)
    #
    #--- extract entries which acis column is not signed off
    #
    entries = oda.select_non_signed_off('acis')
    obs_list = create_obs_list(entries)
    address = 'arots\@head.cfa.harvard.edu'
    text = "This message is a weekly summary of obsid.revs which need ACIS-specific changes:\n\n"
    send_sign_off_email(obs_list, address, text)

    #
    #--- extract entries which si mode column is not signed off
    #
    entries = oda.select_non_signed_off('si_mode')
    obs_list = create_obs_list(entries)
    #
    #--- separate them into acis and hrc cases
    #
    acis_si = []
    hrc_si = []
    for ent in obs_list:
        atemp = re.split('\.', ent)
        db = osq.OcatDB(int(fllat(atemp[0])))
        inst = db.origValue('instrument')
        if inst.lower() == 'acis':
            acis_si.append(ent)
        else:
            hrc_si.append(ent)
#
# --- acis si
#
    if len(acis_si) > 0:
        address = '*****@*****.**'
        text = "This message is a weekly summary of obsid.revs which need SI-specific changes:\n\n"
        send_sign_off_email(acis_si, address, text)
#
#--- hrc si
#
    if len(hrc_si) > 0:
        address = '*****@*****.**'
        text = "This message is a weekly summary of obsid.revs which need SI-specific changes:\n\n"
        send_sign_off_email(acis_si, address, text)
Esempio n. 2
0
def verificaiton_request():
    """
    send out verification request email to poc
    input:  none but read from  updates_table list
    output: email sent out
    """
    #
    #--- extract un-verified data from updates list
    #
    unverified = oda.select_non_signed_off('verified')
    #
    #--- create a dictioany poc <---> obsidrev
    #
    pdict = {}
    poc_list = []
    for ent in unverified:
        obsrev = ent[0]
        gen = ent[1].lower()
        acis = ent[2].lower()
        si = ent[3].lower()
        poc = ent[6]
        date = ent[-1]
        #
        #--- if the request is older than two months ago, ignore
        #
        if check_in_two_months(date) == False:
            continue
        if (gen == 'na') or (acis == 'na') or (si == 'na'):
            continue

        try:
            olist = pdict[poc]
            olist.append(obsrev)
            pdict[poc] = olist
        except:
            pdict[poc] = [obsrev]
            poc_list.append(poc)
#
#--- make sure that poc names appear only once in the list
#
    poc_list = list(set(poc_list))

    for poc in poc_list:
        obs_list = pdict[poc]
        obs_list = list(set(obs_list))

        address = oda.get_email_address(poc)
        subject = "Verification needed for obsid.revs"

        text = "All requested edits have been made for the following obsid.revs:\n\n"
        content = make_sign_off_request_text(text, obs_list)

        send_sign_off_email(obs_list, address, text)
Esempio n. 3
0
    def extract_data_for_rm_page(self, submitter, interval=1):
        """
        extract data which arenot verified and those which were verified in the past "interval" days
        input:  submitter   --- the id of the submitter
                interval    --- time span in day which you want to display toward the past: default=1
        output: alist   a list of lists of extracted data
    
                        [obsidrev, general, acis, si mode, verified, seq number, poc, date, 
                         name of gen_status, name of acis_status, name of si mode stateus, 
                         name of verified status, gen_removable?, acis_removable?, si_mode_removable?
                         verify_removable?]
        """
        #
        #--- find data which created today or yesterday
        #
        odate = ocf.find_date_of_interval_date_before(interval)
        tlist = oda.get_data_newer_than_date(odate)
        #
        #--- find data which are not verified
        #
        tlist2 = oda.select_non_signed_off('verified')
        tlist = tlist + tlist2
        #
        #--- remove the entries which are already in approved list
        #
        alist = []
        for ent in tlist:
            obsidrev = ent[0]
            atemp = re.split('\.', obsidrev)

            if ocf.is_approved(atemp[0]):
                continue
            else:
                alist.append(ent)
#
#--- get unique entries
#
        alist = ocf.find_unique_entries(alist)
        #
        #--- add several extra information which will be used to display the data
        #
        alist = self.add_extra_information(alist, submitter)
        #
        #--- if the list is empty, return <blank> insted
        #
        if len(alist) == 0:
            alist = ''

        return alist
Esempio n. 4
0
    def extract_data_for_display(self):
        """
        extract data which arenot verified and those which were verified in the past "interval" days
        input: interval --- time span in day which you want to display toward the past: default=1
               obsid    --- obsid, defalut <blank> (ignored)
               prop_num --- proposal number: defalut: <blank> (ignored)
        output: alist   a list of lists of extracted data
    
                        [obsidrev, general, acis, si mode, verified, seq number, poc, date, 
                         name of gen_status, name of acis_status, name of si mode stateus, 
                         name of verified status, new comments?, large coord shift?, multi rev?, 
                         higher rev?, obsidrev (for prev), in approved list?]
        """
        #
        #--- selected by obsid
        #
        if self.disp_obsid != '':
            alist = oda.select_data_for_obsid(self.disp_obsid)
#
#--- selected by seqno
#
        elif self.seqno != '':
            alist = oda.select_data_for_seqno(self.seqno)
#
#--- selected by prop_num
#
        elif self.prop_num != '':

            alist = self.select_data_for_prop_num(self.prop_num)
#
#--- normal cases or selected by date interval
#
        else:
            odate = ocf.find_date_of_interval_date_before(self.interval)
            alist = oda.get_data_newer_than_date(odate)
            #
            #--- find data which are not verified and add it if the data include only the day before
            #
            if self.interval == 1:
                alist2 = oda.select_non_signed_off('verified')
                alist = alist + alist2
#
#--- get unique entries
#
            alist = ocf.find_unique_entries(alist)
            alist = self.add_extra_information(alist)

        return alist