Esempio n. 1
0
def collection(botasky_host, botasky_port):
    args_info = args()

    #case when ??

    if args_info.defaultfile:
        config_file = '*' + args_info.defaultfile
        colConfig = recursiveSearchFile(project_abdir, config_file)[0]
        config.read(colConfig)
    else:
        colConfig = recursiveSearchFile(project_abdir, '*colConfig.ini')[0]
        config.read(colConfig)

    # api auth
    api_user = config.get('COLLECTION_API', 'user')
    api_password = config.get('COLLECTION_API', 'password')
    # monited machine
    monit_host = config.get('MONITED_MACHINE', 'host')
    monit_port = int(config.get('MONITED_MACHINE', 'port'))
    monit_user = config.get('MONITED_MACHINE', 'user')
    monit_password = config.get('MONITED_MACHINE', 'password')

    if args_info.mfsmaster == True:
        while 1:
            MoosefsMaster(botasky_host, botasky_port, 'v1000', api_user,
                          api_password, monit_host, monit_port, monit_user,
                          monit_password)

    if args_info.mfscgiserv:
        while 1:
            MoosefsCgiserv(botasky_host, botasky_port, 'v1000', api_user,
                           api_password, monit_host, monit_port, monit_user,
                           monit_password)

    if args_info.mfsmount:
        while 1:
            MoosefsMount(botasky_host, botasky_port, 'v1000', api_user,
                         api_password, monit_host, monit_port, monit_user,
                         monit_password)

    if args_info.mfschunkserver:
        while 1:
            MoosefsChunk(botasky_host, botasky_port, 'v1000', api_user,
                         api_password, monit_host, monit_port, monit_user,
                         monit_password)

    if args_info.mfsmetalogger:
        while 1:
            MoosefsLogger(botasky_host, botasky_port, 'v1000', api_user,
                          api_password, monit_host, monit_port, monit_user,
                          monit_password)

    if args_info.keepalive:
        pass
    if args_info.keepalive_vip:
        pass
Esempio n. 2
0
# -*- coding: utf-8 -*-

"""
Created on 2020-8-18


@module: build tree
@used: build material tree
"""

from utils.MyCONN import MySQL

from utils.MyFILE import project_abdir, recursiveSearchFile
import configparser
config = configparser.ConfigParser()
colConfig = recursiveSearchFile(project_abdir, '*metaConfig.ini')[0]
config.read(colConfig)

def flush_batch_order_relation_relationbatches(dbconfig):
    db = MySQL(dbconfig)
    sql = "update tasly_warehouse.batch_order_relation set relation_batches = '';"
    db.insert(sql)
    db.close()

def insert_batch_order_relation_relationbatches(dbconfig):
    try:
        db = MySQL(dbconfig)
        #sql = "select material,material_description,max(id),max(order_num) from batch_order_relation where movement_type in (101) and order_num != '' and batch = '000203007T' group by material,material_description;"
        sql = "select material,material_description,batch,max(id),max(order_num) from batch_order_relation where movement_type in (101) and order_num != '' group by material,material_description,batch;"
        db.query(sql)
        order_num_id_info = db.fetchAllRows()
Esempio n. 3
0
@module: botasky agent
@used: agent of botasky, use to collect infomation
"""

import os
import argparse

from boagent.module.mfs import MoosefsMaster, MoosefsCgiserv, MoosefsChunk, MoosefsLogger, MoosefsMount

from boagent.utils.MyDAEMON import daemonize

from boagent.utils.MyTIMEOUT import TimeoutError

from utils.MyLOG import MyLog
from utils.MyFILE import project_abdir, recursiveSearchFile
logConfig = recursiveSearchFile(project_abdir, '*logConfig.ini')[0]
mylog = MyLog(logConfig, 'run.py')
logger = mylog.outputLog()

import ConfigParser
config = ConfigParser.ConfigParser()

__all__ = ['args', 'collection', 'main']
__author__ = 'zhihao'


def args():
    parser = argparse.ArgumentParser(description='botasky agent')

    parser.add_argument('-f', '--defaultfile', help='set configuration files')