Exemple #1
0
def runTasks(task_list, data, result_fn):
    if not (isinstance(task_list, list)):
        return -1

    createWorkFile(data)

    for task in task_list:
        taskFileName = env.SCRIPTS_DIR_PATH + task

        if os.path.exists(taskFileName):
            execT.execTaskAndWriteResultToFile([taskFileName], result_fn)
            sysloger.log(env.EVENT_RUN_TASK + taskFileName)

        else:
            sysloger.log(env.ERROR_FILE_NOT_FOUND + taskFileName)
Exemple #2
0
def main():
    flag = sys.argv[1]

    if flag == "-he":
        # python main.py -he
        executeTasks(env.MAIN_CONFIG_FILE_PATH)

    elif flag == "-ne":
        # python main.py -ne email_addr password
        email_addr, password = sys.argv[2], sys.argv[3]
        getSettingsFromNetAndExecuteTasks(email_addr, password)

    else:
        sysloger.log(env.INVALID_START_PARAM + flag)
        sys.exit(-1)
Exemple #3
0
def getConfData(email_addr, password):
    emailStruct = rGmail.readGmail(email_addr, password, \
                                env.DBS_CONF_SUBJECT_TYPE)
    jsonStruct = emailStruct.get_body()
    sysloger.log(env.EVENT_GET_CONF)
    return pConf.strToJsonConfStruct(jsonStruct)
Exemple #4
0
def getData(email_addr, password):
    emailS = rGmail.readGmail(email_addr, password, \
                            env.DBS_DATA_SUBJECT_TYPE)
    sysloger.log(env.EVENT_GET_DATA)
    return emailS.get_body()
Exemple #5
0
def getReport(email_addr, password):
    emailS = rGmail.readGmail(email_addr, password, \
                                 env.DBS_REPORT_SUBJECT_TYPE)

    sysloger.log(env.EVENT_GET_REPORT)
    return emailS
Exemple #6
0
def sendConfData(email_from, email_to, password, confData, confName):
    sGmail.sendGmail(email_from, email_to, env.DBS_CONF_SUBJECT_TYPE, \
                    password, confData, confName)
    sysloger.log(env.EVENT_SEND_CONF)
Exemple #7
0
def sendData(email_from, email_to, password, data, fname):
    sGmail.sendGmail(email_from, email_to, env.DBS_DATA_SUBJECT_TYPE,\
                     password, data, fname)
    sysloger.log(env.EVENT_SEND_DATA)
Exemple #8
0
def sendReport():
    sReport.sendReport(env.MAIN_CONFIG_FILE_PATH)
    sysloger.log(env.EVENT_SEND_REPORT)
Exemple #9
0
def clearWordSpace(fname):
    pConf.removef(fname)
    sysloger.log(env.EVENT_CLEAR_WORK_SPACE + fname)
Exemple #10
0
def createWorkFile(wordData):
    pConf.writef(env.MAIN_DATA_FILE_PATH, wordData)
    sysloger.log(env.EVENT_CREATE_WORD_SPACE)