예제 #1
0
파일: core.py 프로젝트: briandrawert/pathos
def copy(source, destination=None, **kwds):
  '''copy source to (possibly) remote destination

Execute a copy, and return the copier. Use 'kill' to kill the copier, and 
'pid' to get the process id for the copier.

Inputs:
    source      -- path string of source 'file'
    destination -- path string for destination target
  '''
  #XXX: options, background, stdin can be set w/ kwds (also name, launcher)
  if destination is None: destination = os.getcwd()
  from LauncherSCP import LauncherSCP
  opt = kwds.pop('options', None)
  kwds['background'] = kwds.pop('bg', False) # ignores 'background'
  copier = LauncherSCP(**kwds)
  if ':' in source or ':' in destination:
    if opt is None: opt = '-q -r'
    copier(options=opt, source=source, destination=destination)
  else:
    if opt is None: opt = '-r'
    copier(launcher='cp', options=opt, source=source, destination=destination)
  logging.info('executing {%s}', copier.message)
  copier.launch()
  copier.kill()
  return copier
예제 #2
0
def copy(filename, rhost, dest):
  '''copy 'file' object to target destination

Inputs:
    filename    -- path string of source 'file'
    rhost       -- hostname of destination target
    destination -- path string for destination target
  '''
  from LauncherSCP import LauncherSCP
  copier = LauncherSCP('copy_%s' % filename)
  logging.info('executing {scp %s %s:%s}', filename, rhost, dest)
  copier.stage(options='-q', source=filename, destination=rhost+':'+dest)
  copier.launch()
  return
예제 #3
0
def copy(source, destination=None, **kwds):
    '''copy source to (possibly) remote destination

Execute a copy, and return the copier. Use 'kill' to kill the copier, and 
'pid' to get the process id for the copier.

Inputs:
    source      -- path string of source 'file'
    destination -- path string for destination target
  '''
    #XXX: options, background, stdin can be set w/ kwds (also name, launcher)
    if destination is None: destination = os.getcwd()
    from LauncherSCP import LauncherSCP
    opt = kwds.pop('options', None)
    kwds['background'] = kwds.pop('bg', False)  # ignores 'background'
    copier = LauncherSCP(**kwds)
    if ':' in source or ':' in destination:
        if opt is None: opt = '-q -r'
        copier(options=opt, source=source, destination=destination)
    else:
        if opt is None: opt = '-r'
        copier(launcher='cp',
               options=opt,
               source=source,
               destination=destination)
    logging.info('executing {%s}', copier.message)
    copier.launch()
    copier.kill()
    return copier
예제 #4
0
파일: core.py 프로젝트: yuhjay/vmaf
def copy(file, rhost, dest):
    '''copy 'file' object to target destination

Inputs:
    source      -- path string of source 'file'
    rhost       -- hostname of destination target
    destination -- path string for destination target
  '''
    from LauncherSCP import LauncherSCP
    copier = LauncherSCP('copy_%s' % file)
    #print 'executing {scp %s %s:%s}' % (file,rhost,dest)
    copier.stage(options='-q', source=file, destination=rhost + ':' + dest)
    copier.launch()
    return