tidy worker codes
This commit is contained in:
parent
fbe88b0cbb
commit
c486930d8f
|
@ -20,12 +20,11 @@ from configparser import ConfigParser
|
|||
from io import StringIO
|
||||
import os,sys,subprocess,time,re,datetime,threading,random
|
||||
import xmlrpc.client
|
||||
from model import db, Image
|
||||
from com.model import db, Image
|
||||
|
||||
from log import logger
|
||||
import env
|
||||
from lvmtool import *
|
||||
import updatebase
|
||||
from com.log import logger
|
||||
from com import env, updatebase
|
||||
from worker.lvmtool import *
|
||||
import requests
|
||||
|
||||
master_port = str(env.getenv('MASTER_PORT'))
|
|
@ -6,7 +6,7 @@ import argparse
|
|||
import sys
|
||||
import time # this is only being used as part of the example
|
||||
import os
|
||||
import env
|
||||
from com import env
|
||||
|
||||
# logger should only be imported after initlogging has been called
|
||||
logger = None
|
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import subprocess, env, threading
|
||||
from log import logger
|
||||
import subprocess, threading
|
||||
from com.log import logger
|
||||
from com import env
|
||||
|
||||
class ipcontrol(object):
|
||||
@staticmethod
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import requests, json
|
||||
import env
|
||||
from com import env
|
||||
|
||||
proxy_api_port = env.getenv("PROXY_API_PORT")
|
||||
proxy_control="http://localhost:"+ str(proxy_api_port) +"/api/routes"
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os, shutil
|
||||
from log import logger
|
||||
from com.log import logger
|
||||
|
||||
def aufs_remove(basefs):
|
||||
try:
|
|
@ -1,12 +1,10 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import subprocess, os, json
|
||||
import imagemgr
|
||||
import network
|
||||
from log import logger
|
||||
import env
|
||||
from lvmtool import sys_run, check_volume
|
||||
from monitor import Container_Collector, History_Manager
|
||||
from com.log import logger
|
||||
from com import env, imagemgr
|
||||
from worker.lvmtool import sys_run, check_volume
|
||||
from worker.monitor import Container_Collector, History_Manager
|
||||
import lxc
|
||||
|
||||
class Container(object):
|
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import env,subprocess,os,time
|
||||
from log import logger
|
||||
import subprocess,os,time
|
||||
from com.log import logger
|
||||
from com import env
|
||||
|
||||
def sys_run(command,check=False):
|
||||
Ret = subprocess.run(command, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, shell=True, check=check)
|
||||
|
@ -161,5 +162,3 @@ def delete_volume(group_name, volume_name):
|
|||
return False
|
||||
else:
|
||||
logger.info("lv %s in vg %s does not exists" % (volume_name,group_name))
|
||||
|
||||
|
|
@ -1,22 +1,24 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
# first init env
|
||||
import env, tools
|
||||
import sys
|
||||
sys.path.append("../")
|
||||
from com import env, tools
|
||||
config = env.getenv("CONFIG")
|
||||
tools.loadenv(config)
|
||||
#tools.loadenv(config)
|
||||
|
||||
# must import logger after initlogging, ugly
|
||||
from log import initlogging
|
||||
initlogging("docklet-worker")
|
||||
from log import logger
|
||||
from com.log import initlogging
|
||||
#initlogging("docklet-worker")
|
||||
from com.log import logger
|
||||
|
||||
import xmlrpc.server, sys, time
|
||||
from socketserver import ThreadingMixIn
|
||||
import threading
|
||||
import etcdlib, network, container
|
||||
from nettools import netcontrol,ovscontrol,portcontrol
|
||||
import monitor, proxytool
|
||||
from lvmtool import new_group, recover_group
|
||||
from com import etcdlib, proxytool
|
||||
from worker import container, monitor
|
||||
from com.nettools import netcontrol,ovscontrol,portcontrol
|
||||
from worker.lvmtool import new_group, recover_group
|
||||
|
||||
##################################################################
|
||||
# Worker
|
Loading…
Reference in New Issue