本文整理汇总了Python中process.Process.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Process.__init__方法的具体用法?Python Process.__init__怎么用?Python Process.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类process.Process
的用法示例。
在下文中一共展示了Process.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Process.__init__(self)
if (len(args) > 1 and
not any(isinstance(arg, (TableExpression, list, tuple))
for arg in args)):
args = (args,)
self.args = args
suffix = kwargs.pop('suffix', '')
fname = kwargs.pop('fname', None)
mode = kwargs.pop('mode', 'w')
if kwargs:
kwarg, _ = kwargs.popitem()
raise TypeError("'%s' is an invalid keyword argument for csv()"
% kwarg)
if fname is not None and suffix:
raise ValueError("csv() can't have both 'suffix' and 'fname' "
"arguments")
if fname is None:
suffix = "_" + suffix if suffix else ""
fname = "{entity}_{period}" + suffix + ".csv"
self.fname = fname
if mode not in ('w', 'a'):
raise ValueError("csv() mode argument must be either "
"'w' (overwrite) or 'a' (append)")
self.mode = mode
示例2: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self, name , priority, message, numero):
Process.__init__(self, name, 4, priority)
self.message = message
self.numero = numero
self.timer = int(0.02* len(message))+1
# 0 no usa , 1 usa , 2 bloquea
self.external = {'Pantalla': 0, 'Audifono': 1, 'Microfono': 0, 'GPS': 0, 'Enviar Info': 1, 'Recibir Info': 1}
示例3: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self,context,id):
Process.__init__(self,context,id)
if 'config' in context:
self.__config__ = context['config']
else:
raise Exception('WestGridStatusProcess','no config found in context.')
if 'process' in self.__config__:
if 'host' in self.__config__['process']:
self.__host__ = self.__config__['process']['host']
else:
raise Exception('WestGridProcess','required field [process]:host not found in workfile')
if 'user' in self.__config__['process']:
self.__user__ = self.__config__['process']['user']
else:
self.__user__ = environ['USER']
if 'key' in self.__config__['process']:
self.__key__ = self.__config__['process']['key']
else:
if 0 == system( 'touch ~/.ssh/id_rsa &> /dev/null' ):
self.__key__ = '~/.ssh/id_rsa'
else:
raise Exception('WestGridProcess','required field [process]:key="~/.ssh/id_rsa" not found in workfile')
else:
raise Exception('WestGridProcess','no process section found in workfile')
self.__last_time__ = 0
self.__jobs__ = {}
task = WG_DeployTask( self.id(), None, self.__config__ )
task.execute()
示例4: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self,context,id):
Process.__init__(self,context,id)
if 'config' in context:
self.__config__ = context['config']
#display( OUTPUT_DEBUG, str(self.__config__) )
else:
raise Exception('ExperimentProcess','no config found in context.')
repeat = 0
runs = 0
if 'process' in self.__config__:
if 'repeat' in self.__config__['process']:
self.__repeat__ = int(self.__config__['process']['repeat'])
else:
raise Exception('ExperimentProcess','no repeats field found in process section of workfile')
if 'runs' in self.__config__['process']:
runs = int(self.__config__['process']['runs'])
else:
raise Exception('ExperimentProcess','no runs field found in process section of workfile')
else:
raise Exception('ExperimentProcess','no process section found in workfile')
self.__first__ = False
self.__parameters__ = int( runs / self.__repeat__ )
self.display( OUTPUT_MAJOR, '%s initialized for %d parameters totalling %d runs' % (self.__config__['process']['config'], self.__parameters__, runs) )
self.__queueAnalysis__()
示例5: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self, env, me):
Process.__init__(self)
self.ballot_number = None
self.accepted = PValueSet()
self.me = me
self.env = env
self.env.addProc(self)
示例6: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self,context,pid):
Process.__init__(self,context,pid)
if 'config' in context:
self._config = context['config']
#display( OUTPUT_DEBUG, str(self.__config__) )
else:
raise Exception('RandomTestProcess','no config found in context.')
self._start = time()
self._tasktime = 1
self._nextid = 0
if 'process' in self._config:
if 'tasktime' in self._config['process']:
self._tasktime = float(self._config['process']['tasktime'])
if 'period' in self._config['process']:
self._period = float(self._config['process']['period'])
if 'ctrltasktime' in self._config['process']:
self._ctrltasktime = float(self._config['process']['ctrltasktime'])
if 'maxtasks' in self._config['process']:
self._maxtasks = int(self._config['process']['maxtasks'])
self.__queueRandomTestTask__(10)
self.determineState()
示例7: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self, args, desc, parent=None):
if isinstance(args, basestring):
command = '%s %s' % (self.program, args)
else:
command = (self.program,) + tuple(args)
Process.__init__(self, command, self.title, desc, parent)
示例8: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self):
Process.__init__(self)
self.block_render = True
self.ticks = 0
self.page = 0
self.dest_page = 0
self.state = 0 # 0 = zoom out, 1 = control, 2 = zoom in, 3 = change page
示例9: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self,config,pid):
Process.__init__(self,config,pid)
self._interval = 300
self._last = time() - self._interval
self._data = None
self.display( OUTPUT_VERBOSE, 'status process activated' )
示例10: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self, env, id, config):
Process.__init__(self, env, id)
self.ballot_number = BallotNumber(0, self.id)
self.active = False
self.proposals = {}
self.timeout = 1.0
self.config = config
self.env.addProc(self)
示例11: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self,name,priority,numero,duracion):
Process.__init__(self,name,2,priority)
self.numero = numero;
self.hist = Historial()
self.duracion = int(duracion)
self.timer = int(duracion)
# 0 no usa , 1 usa , 2 bloquea
self.external = {'Pantalla': 1, 'Audifono': 2, 'Microfono': 2, 'GPS': 0, 'Enviar Info': 1, 'Recibir Info': 1}
示例12: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self, outQueue, errQueue, proc_count=10, headers={}):
self.outQueue = outQueue
self.errQueue = errQueue
self.headers = {}
self.timeOut = 5
Process.__init__(self, proc_count)
示例13: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self, env, id, config):
Process.__init__(self, env, id)
self.slot_in = self.slot_out = 1
self.proposals = {}
self.decisions = {}
self.requests = []
self.config = config
self.env.addProc(self)
示例14: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Process.__init__(self)
self.args = args
self.print_exprs = kwargs.pop('print_exprs', False)
if kwargs:
kwarg, _ = kwargs.popitem()
raise TypeError("'%s' is an invalid keyword argument for show()"
% kwarg)
示例15: __init__
# 需要导入模块: from process import Process [as 别名]
# 或者: from process.Process import __init__ [as 别名]
def __init__(self, env, me, leader, acceptors, ballot_number):
Process.__init__(self)
self.env = env
self.me = me
self.leader = leader
self.acceptors = acceptors
self.ballot_number = ballot_number
self.env.addProc(self)