コード例 #1
0
#coding=utf-8
import os,sys
path = os.path.abspath(__file__).replace('\\', '/')
absdir = path[0:path.rfind('/')]
sys.path.append(absdir[0:absdir.rfind('/',0,len(absdir))])
from common.utils import getpathinfo, setlogging
masterport = sys.argv[1] if len(sys.argv) == 2 else '4244'
logsdir = getpathinfo.get_logs_dir(os.path.abspath(__file__).replace('\\', '/'))
s3transferPath = logsdir[0:logsdir.rfind('/',0,len(logsdir)-1)]

masterslogdir = logsdir+'log-masters/'
if os.path.exists(masterslogdir) == False:
    os.mkdir(masterslogdir)
logFileName = 'log-master-' + str(masterport) + '.txt'
setlogging.set_logging(masterslogdir+logFileName)

reload(sys)
sys.setdefaultencoding('utf8')

from common.const import type, port
from common.enum import status
from common.myexceptions import ossexception,jobexception
from common.utils import clean,timeoperation,configoperations,mail
from utils import collectinfo,decodeID
import taskpool
from time import sleep
from common.sdk import s3client, tencentclient, aliyunclient, clientfactory
from SimpleXMLRPCServer import SimpleXMLRPCServer
import workermanagerinfo
from mastermessage import MasterMessage
from worker.workermessage import WorkerMessage
コード例 #2
0
ファイル: mastermanager.py プロジェクト: erician/s3transfer
#encoding=utf-8
import os, sys
path = os.path.abspath(__file__).replace('\\', '/')
absdir = path[0:path.rfind('/')]
sys.path.append(absdir[0:absdir.rfind('/', 0, len(absdir))])

from common.utils import getpathinfo, setlogging
logsdir = getpathinfo.get_logs_dir(
    os.path.abspath(__file__).replace('\\', '/'))
logFileName = 'log-mastermanager.txt'
setlogging.set_logging(logsdir + logFileName)

reload(sys)
sys.setdefaultencoding('utf8')
from common.enum import status
from SimpleXMLRPCServer import SimpleXMLRPCServer
from common.const import port
from common.utils import process, mail
from common.dataobject.message import Message
from collections import deque
from multiprocessing import cpu_count
import threading
import xmlrpclib
import masterinfo
from time import sleep
from SocketServer import ThreadingMixIn
import logging
log = logging.getLogger('root')
"""异步的server类"""

コード例 #3
0
ファイル: worker.py プロジェクト: erician/s3transfer
#coding=utf-8
import os,sys
path = os.path.abspath(__file__).replace('\\', '/')
absdir = path[0:path.rfind('/')]
sys.path.append(absdir[0:absdir.rfind('/',0,len(absdir))])
from common.utils import getpathinfo, setlogging, timeoperation

workerport = sys.argv[1] if len(sys.argv) == 2 else '5253'
logsdir = getpathinfo.get_logs_dir(os.path.abspath(__file__).replace('\\', '/'))
workerslogdir = logsdir+'log-workers/'
if os.path.exists(workerslogdir) == False:
    os.mkdir(workerslogdir)
logFileName = 'log-worker-' + str(workerport) + '.txt'
setlogging.set_logging(workerslogdir+logFileName)

reload(sys)
sys.setdefaultencoding('utf8')
from SimpleXMLRPCServer import SimpleXMLRPCServer
from common.sdk import s3client
from common.myexceptions import ossexception,taskexception
from common.utils import clean
from common.enum import status
from common.const import port, type
from master.task import GenerateDiskFileListTask, TransferOrCheckTask
from common.utils import readdata
from time import sleep
from collections import deque
import workeragent
import time
import xmlrpclib
import threading