Esempio n. 1
0
def Cleanup(date, connection, aggregationproblems):
    process = RetentionListPreprocessManager(date, init=False)
    initializedhistory = process.getAllWithStatus('initialized')
    configdata = configs['Database']['TransferRetentionListActivity']
    writer = WritetoDB.Writer(configdata)
    writer.write(pd.Timestamp(querytime).date())

    print(initializedhistory)
Esempio n. 2
0
def getPreprocessingState(date, querytime, connections):
    ##send email; something is horribly wrong with the setup of the process; continuing is pointless
    ##log error
    Problems = None
    process = RetentionListPreprocessManager(date)

    #Only Thirthy days are needed atm for the process
    try:
        PreviousRuns = process.getAllSince(querytime)
    except:
        PreviousRuns = None
    return (PreviousRuns)
Esempio n. 3
0
def CollectTop10Commissionable(date, connections, aggregationproblems):
    process = RetentionListPreprocessManager(date, init=False)
    problemhistory = process.getAllWithStatus('incomplete')

    server = configs['SP']['MonthlyTop10GamesCommissionable']['Server']
    proc = configs['SP']['MonthlyTop10GamesCommissionable']['Procedure']
    refdate = pd.Timestamp(aggregationproblems.values[0, 0])

    for data in problemhistory.ProcesStartDate:
        print("Date:{Date}; RefDate:{Refdate}".format(
            Date=pd.Timestamp(data).date(),
            RefDate=pd.Timestamp(refdate).date()))
        if refdate > pd.Timestamp(data):
            HandleProblems(connections, proc, server,
                           'MonthlyTop10Commissionable', data)
        else:
            #step, timeslot, value
            process.setStep('MonthlyTop10Commissionable', pd.Timestamp(data),
                            refdate)
    #run main model:
    try:
        connections[server].ExecNoQuery(
            " EXEC {proc} @startdate='{data}' ".format(
                proc=proc, data=pd.Timestamp(date).date()))

        process.setStep('MonthlyTop10Commissionable', pd.Timestamp(date),
                        pd.Timestamp(date).now())
    except:
        pass
Esempio n. 4
0
def AggregateBalanceCenter(date, connections, aggregationproblems):
    process = RetentionListPreprocessManager(date, init=True)
    problemhistory = process.getAllWithStatus('incomplete')

    server = configs['SP']['AggregateBalanceCenterSummarize']['Server']
    proc = configs['SP']['AggregateBalanceCenterSummarize']['Procedure']
    refdate = pd.Timestamp(aggregationproblems.values[0, 0])
    for data in problemhistory.ProcesStartDate:
        print("Date:{}".format(pd.Timestamp(data).date()))

        if refdate > pd.Timestamp(data):
            HandleProblems(connections, proc, server,
                           'BalanceCenterUpdatedTime', data)
        else:
            #step, timeslot, value
            process.setStep('BalanceCenterUpdatedTime', pd.Timestamp(data),
                            refdate)

    #run main model:
    try:
        connections[server].ExecQuery(
            " EXEC {proc} @startdate='{data}' ".format(
                proc=proc, data=pd.Timestamp(date)))

        process.setStep('BalanceCenterUpdatedTime',
                        pd.Timestamp(date).date(), pd.Timestamp.now())
    except:
        pass
Esempio n. 5
0
def HandleProblems(connections, proc, server, step, data):
    process = RetentionListPreprocessManager(date, init=False)
    try:
        dsserver = configs['Database'][step]['Server']
        table = configs['Database'][step]['Database']
        connections[dsserver].ExecNoQuery(
            " Delete FROM {table} where updatedate = '{data}' ".format(
                data=pd.Timestamp(data).date(), table=table))
    except:
        pass

    try:
        process.setStep('ProcessStatus',
                        pd.Timestamp(data).date(), 'initialized')
        connections[server].ExecNoQuery(
            " EXEC {proc} @startdate='{data}' ".format(
                proc=proc, data=pd.Timestamp(data).date()))
        process.setStep(step, pd.Timestamp(data).date(), pd.Timestamp.now())

    except:
        pass
Esempio n. 6
0
def Cleanup(date,connection, aggregationproblems):
    process = RetentionListPreprocessManager(date, init = False)
    initializedhistory = process.getAllWithStatus('initialized')
    sectored = initializedhistory.loc[ initializedhistory.ProcesStartDate == initializedhistory.BalanceCenterUpdatedTime , :]
    for k in sectored.iterrows():
        process.setStep('ProcessStatus',pd.Timestamp(k.ProcessStartDate).date(),'completed')             
Esempio n. 7
0
def AggregateBalanceCenter(date, connections, aggregationproblems):
    process = RetentionListPreprocessManager(date, init=True)
    problemhistory = process.getAllWithStatus('incomplete')
    
    server = configs['SP']['AggregateBalanceCenterSummarize']['Server']
    proc   = configs['SP']['AggregateBalanceCenterSummarize']['Procedure']
    refdate = pd.Timestamp(aggregationproblems.values[0,0])
    for data in problemhistory.ProcesStartDate:
        print("Date:{}".format(pd.Timestamp(data).date()))

        if refdate > pd.Timestamp(data):
          try:
            dsserver = configs['Database']['DS_RetentionlistBetrecordDailySummary']['Server']
            table    = configs['Database']['DS_RetentionlistBetrecordDailySummary']['Database']
            connections[dsserver].ExecNoQuery(" Delete FROM {table} where updatedate = '{data}' ".
                         format(data  = pd.Timestamp(data).date(),
                                table = table ))
          except:
            pass
                        
          try:  
            process.setStep('ProcessStatus',pd.Timestamp(data).date(),'initialized')             
            connections[server].ExecNoQuery(" EXEC {proc} @startdate='{data}' ".
                         format(proc = proc, data = pd.Timestamp(data).date()))
            process.setStep('BalanceCenterUpdatedTime',pd.Timestamp(data).date(), pd.Timestamp(data).date())
            
          except:
            pass
        else:
            #step, timeslot, value
            process.setStep('BalanceCenterUpdatedTime',pd.Timestamp(data).date(), refdate)
    
    #run main model:
    try:
        
        connections[server].ExecNoQuery(" EXEC {proc} @startdate='{data}' ".
                         format(proc = proc, data = pd.Timestamp(date).date()))
        
        process.setStep('BalanceCenterUpdatedTime',pd.Timestamp(date).date(), pd.Timestamp(date).date())
    except:
        pass
Esempio n. 8
0
def Cleanup(date, connection, Problems):
    process = RetentionListPreprocessManager(date, init=False)
    initializedhistory = process.getAllWithStatus('initialized')
    '''