def __init__(self, prevState): super(TryEmitState, self).__init__(prevState) if settings.get('hash_bucket'): self.local['out_key'] = settings['temp_storage_base'] + rand_str(1) + '/' + rand_str(16) + '/' else: self.local['out_key'] = settings['storage_base'] + rand_str(16) + '/' params = {'out_key': self.local['out_key']} self.commands = [ s.format(**params) if s is not None else None for s in self.commands ]
def __init__(self, prevState): super(RunState, self).__init__(prevState) if settings.get('hash_bucket'): self.local['out_key'] = settings['temp_storage_base'] + rand_str(1) + '/' + rand_str(16) + '/' else: self.local['out_key'] = settings['storage_base'] + rand_str(16) + '/' params = {'in_key_0': self.in_events['frames_0']['key'], 'in_key_1': self.in_events['frames_1']['key'], 'out_key': self.local['out_key'], 'filter_complex': self.config['filter_complex']} logging.debug('params: '+str(params)) self.commands = [ s.format(**params) if s is not None else None for s in self.commands ]
def __init__(self, prevState, in_events, emit): super(InitState, self).__init__(prevState, in_events=in_events, trace_func=default_trace_func) self.emit = emit self.out_key = settings['storage_base'] + in_events['video_url'][ 'metadata']['pipe_id'] + '/monostage_gs/' + rand_str(16) + '/' logging.debug('in_events: ' + str(in_events) + ', emit: ' + str(emit))
def __init__(self, prevState): super(RunState, self).__init__(prevState, trace_func=default_trace_func) if settings.get('hash_bucket'): self.local['out_key'] = settings['temp_storage_base'] + rand_str( 1) + '/' + rand_str(16) + '/' else: self.local['out_key'] = settings['storage_base'] + rand_str( 16) + '/' params = { 'key': self.in_events['chunks']['key'], 'out_key': self.local['out_key'] } logging.debug('params: ' + str(params)) self.commands = [ s.format(**params) if s is not None else None for s in self.commands ]
def __init__(self, pipe_id=None): self.pipe_id = strftime("%Y%m%d%H%M%S", localtime()) + '-' + rand_str( 4) if pipe_id is None else pipe_id self.stages = {} self.inputs = {} self.outputs = {} self.pipedata = {} # pipeline-wide data shared by stages self.scrub_bar_time = 0.0 self.tasks = []
def __init__(self, prevState): super(RunState, self).__init__(prevState) if settings.get('hash_bucket'): self.local['out_key'] = settings['temp_storage_base'] + rand_str( 1) + '/' + rand_str(16) + '/' else: self.local['out_key'] = settings['storage_base'] + rand_str( 16) + '/' params = { 'starttime': self.in_events['chunked_link']['starttime'], 'frames': self.in_events['chunked_link']['frames'], 'URL': self.in_events['chunked_link']['key'], 'selector': self.in_events['chunked_link']['selector'], 'out_key': self.local['out_key'] } logging.debug('params: ' + str(params)) self.commands = [ s.format(**params) if s is not None else None for s in self.commands ]
def __init__(self, prevState): super(TryEmitState, self).__init__(prevState) flist = self.local['output'].rstrip().split('\n') # pdb.set_trace() self.local['key_list'] = [ settings['storage_base'] + self.in_events['frames']['metadata']['pipe_id'] + '/grayscale_flat/' + str(rand_str(16)) for f in flist ] pairs = [ flist[i] + ' ' + self.local['key_list'][i] for i in xrange(len(self.local['key_list'])) ] self.commands = [ s.format(**{'pairs': ' '.join(pairs)}) if s is not None else None for s in self.commands ]
def __init__(self, prevState): super(RunState, self).__init__(prevState) self.local['out_key'] = settings['storage_base'] + self.in_events[ 'mod_chunked_link']['metadata']['pipe_id'] + '/decode/' + rand_str( 16) + '/' params = { 'starttime': self.in_events['mod_chunked_link']['starttime'], 'frames': self.in_events['mod_chunked_link']['frames'], 'URL': self.in_events['mod_chunked_link']['key'], 'out_key': self.local['out_key'] } logging.debug('params: ' + str(params)) self.commands = [ s.format(**params) if s is not None else None for s in self.commands ]
def __init__(self, prevState): super(RunState, self).__init__(prevState) key = self.in_events.keys()[0] out_key = settings['storage_base'] + self.in_events['chunked_link'][ 'metadata']['pipe_id'] + '/goldeneye/' + rand_str(10) + '/' params = { 'out_key': out_key, 'duration': self.config['duration'], 'nworkers': self.config['nworkers'], 'nsockets': self.config['nsockets'], 'outdir': self.config['outdir'] } self.commands = [ s.format(**params) if s is not None else None for s in self.commands ] self.emit_event( key, self.in_events.values()[0]) # just forward whatever comes in
def __init__(self, prevState, **kwargs): super(CommandListState, self).__init__(prevState, **kwargs) # explicit expect if given, otherwise set expect based on previous command self.expects = [ self.commandlist[0][0] if isinstance(self.commandlist[0], tuple) else "OK" ] self.commands = [ cmd[1] if isinstance(cmd, tuple) else cmd for cmd in self.commandlist ] pre_expects = [ cmd[0] if isinstance(cmd, tuple) else handler.expected_response(pc) for (cmd, pc) in zip(self.commandlist[1:], self.commands[:-1]) ] if self.pipelined: # in pipelined mode, we send all commands at once, and wait for all responses afterward self.commands = [cmd for cmd in self.commands if cmd is not None] pre_expects = [ exp for exp in pre_expects if pre_expects is not None ] self.expects += [None] * (len(self.commands) - 1) + pre_expects self.commands += [None] * (len(pre_expects)) assert len(self.expects) == len( self.commands ), "Could not pipeline this state. Are there no commands?" else: # if we're not pipelined, then we just do command-response self.expects += pre_expects logger.debug(self.expects) if self.expects[0] is None: self.expects[0] = rand_str(32) self.kick()
def get_output_key(): if settings.get('hash_bucket'): return settings['temp_storage_base'] + rand_str(1) + '/' + rand_str(16) + '/' else: return settings['storage_base'] + rand_str(16) + '/'
def __init__(self, prevState, **kwargs): # need to set random expect string first to prevent OnePassState from kicking us if self.expect is None: self.expect = rand_str(32) super(InfoWatcherState, self).__init__(prevState, **kwargs)
def __init__(self, prevState, **kwargs): super(OnePassState, self).__init__(prevState, **kwargs) if self.expect is None: self.expect = rand_str(32) self.kick()