當前位置: 首頁>>代碼示例>>Python>>正文


Python ddfs.DDFS類代碼示例

本文整理匯總了Python中disco.ddfs.DDFS的典型用法代碼示例。如果您正苦於以下問題:Python DDFS類的具體用法?Python DDFS怎麽用?Python DDFS使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DDFS類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: load_oob

def load_oob(host, name, key):
    from disco.ddfs import DDFS
    ddfs = DDFS(host)
    # NB: this assumes that blobs are listed in LIFO order.
    # We want to return the latest version
    for fd in ddfs.pull(ddfs.job_oob(name), blobfilter=lambda x: x == key):
        return fd.read()
開發者ID:darkua,項目名稱:disco,代碼行數:7,代碼來源:util.py

示例2: push_data

def push_data(self, args):
  path = args['path']
  ds_id = args['ds_id']

  filename = os.path.basename(path)
  tmp_dir = str(int(time.time()))

  # Create temporary files
  os.chdir(config.DISCO_FILES)
  os.makedirs(tmp_dir)
  copy2(filename, "%s/%s" % (tmp_dir, filename))
  os.chdir(tmp_dir)

  command = 'split -n %s %s' % (config.DISCO_NODES, path)
  split_process = Popen(command.split(' '), stdout=PIPE)
  split_process.communicate()

  # Push data to cluster
  command = 'ddfs push data:%s ./xa?' % ds_id
  d = DDFS('disco://localhost')
  files = [("%s/%s/%s" % (config.DISCO_FILES, tmp_dir, filename), filename) for filename in os.listdir(".") if filename.startswith("xa")]
  d.push('data:%s' % ds_id, files)

  r.table('datasets').filter({
      'id': ds_id,
  }).update({
      'state': 'ready_for_crunching'
  }).run(db)
開發者ID:vtemian,項目名稱:kruncher,代碼行數:28,代碼來源:tasks.py

示例3: delete_all

def delete_all():
	'''
	Deletes all tags in DDFS, thus orphaning all blobs and making them subject to eventual removal by the garbage collector.
	'''
	ddfs = DDFS()
	for tag in ddfs.list():
		ddfs.delete(tag)
開發者ID:stefanv,項目名稱:MLTP,代碼行數:7,代碼來源:disco_tools.py

示例4: ddfs_save

def ddfs_save(blobs, name, master):
    from disco.ddfs import DDFS
    ddfs = DDFS(master)
    blobs = [(blob, ('discoblob:%s:%s' % (name, os.path.basename(blob))))
             for blob in blobs]
    tag = ddfs_name(name)
    ddfs.push(tag, blobs, retries=600, delayed=True, update=True)
    return "tag://%s" % tag
開發者ID:JensRantil,項目名稱:disco,代碼行數:8,代碼來源:util.py

示例5: inputexpand

def inputexpand(input, partition=None, settings=DiscoSettings()):
    from disco.ddfs import DDFS, istag
    if ispartitioned(input) and partition is not False:
        return zip(*(parse_dir(i, partition=partition) for i in iterify(input)))
    if isiterable(input):
        return [inputlist(input, partition=partition, settings=settings)]
    if istag(input):
        ddfs = DDFS(settings=settings)
        return chainify(blobs for name, tags, blobs in ddfs.findtags(input))
    return [input]
開發者ID:darkua,項目名稱:disco,代碼行數:10,代碼來源:util.py

示例6: push_by_tag

def push_by_tag(file_paths,tag=None):
	'''
	'''
	ddfs = DDFS()
	if tag is None:
		for file_path in file_paths:
			tag = file_path.split("/")[-1].split(".")[0]
			ddfs.push(tag,[file_path])
	else:
		ddfs.push(tag,file_paths)
開發者ID:stefanv,項目名稱:MLTP,代碼行數:10,代碼來源:disco_tools.py

示例7: setUp

 def setUp(self):
     tag = 'disco:test:authjob'
     self.ddfs = DDFS(self.disco_master_url)
     pushed = self.ddfs.push(tag, [(StringIO('blobdata'), 'blob')])
     self.ddfs.setattr(tag, 'ddfs:read-token', 'r')
     self.input = ['tag://u:[email protected]/' + tag]
     super(AuthJobTestCase, self).setUp()
開發者ID:JensRantil,項目名稱:disco,代碼行數:7,代碼來源:test_authjob.py

示例8: __init__

 def __init__(self, docset_name):
     self.ddfs_tag = docset_name
     self.ddfs_index_tag = docset_name + ':index'
     self.ddfs_link_file_tag = docset_name + ':links'
     self.ddfs = DDFS()
     self.__index = None
     self.dirty = False
開發者ID:sqs,項目名稱:freequery,代碼行數:7,代碼來源:docset.py

示例9: push_by_tag

def push_by_tag(file_paths, tag=None):
    '''
    '''
    ddfs = DDFS()
    if tag is None:
        for file_path in file_paths:
            tag = os.path.splitext(ntpath.basename(file_path))[0]
            try:
                ddfs.push(tag, [file_path])
            except IOError:
                print("Invalid file path specified.")
    else:
        try:
            ddfs.push(tag, file_paths)
        except IOError:
            print("Invalid file path specified.")
開發者ID:gitter-badger,項目名稱:mltsp,代碼行數:16,代碼來源:disco_tools.py

示例10: setUp

 def setUp(self):
     self.ddfs = DDFS(self.disco_master_url)
     self.ddfs.push('disco:test:authrd', [(StringIO('datablob'), 'blobdata')])
     self.ddfs.push('disco:test:authwr', [(StringIO('datablob'), 'blobdata')])
     self.ddfs.setattr('disco:test:authrd', 'a', 'v')
     self.ddfs.setattr('disco:test:authwr', 'a', 'v')
     self.ddfs.setattr('disco:test:authrd', 'ddfs:read-token', 'rdr')
     self.ddfs.setattr('disco:test:authwr', 'ddfs:write-token', 'wtr')
開發者ID:JensRantil,項目名稱:disco,代碼行數:8,代碼來源:test_ddfs.py

示例11: put

 def put(self, key, value):
     """
     Stores an out-of-band result *value* with the key *key*. Key must be unique in
     this job. Maximum key length is 256 characters. Only characters in the set
     ``[a-zA-Z_\-:[email protected]]`` are allowed in the key.
     """
     if DDFS.safe_name(key) != key:
         raise DiscoError("OOB key contains invalid characters (%s)" % key)
     util.save_oob(self.master, self.jobname, key, value)
開發者ID:jamesaimonetti,項目名稱:disco,代碼行數:9,代碼來源:task.py

示例12: AuthJobTestCase

class AuthJobTestCase(DiscoJobTestFixture, DiscoTestCase):
    input = []

    @staticmethod
    def map(e, params):
        return [(e.strip(), '')]

    @property
    def answers(self):
        return [('blobdata', '')]

    def setUp(self):
        tag = 'disco:test:authjob'
        self.ddfs = DDFS(self.disco_master_url)
        pushed = self.ddfs.push(tag, [(StringIO('blobdata'), 'blob')])
        self.ddfs.setattr(tag, 'ddfs:read-token', 'r')
        self.input = ['tag://u:[email protected]/' + tag]
        super(AuthJobTestCase, self).setUp()

    def tearDown(self):
        super(AuthJobTestCase, self).tearDown()
        self.ddfs.delete('disco:test:authjob')
開發者ID:JensRantil,項目名稱:disco,代碼行數:22,代碼來源:test_authjob.py

示例13: __tag_results

    def __tag_results(self, results):
        from disco.ddfs import DDFS
        ddfs = DDFS()
        results_tag = results[0]
        ddfs.put(self.docset.ddfs_link_file_tag, list(ddfs.blobs(results_tag)))

        # remove old, temporary tag
        ddfs.delete(results_tag)
開發者ID:sqs,項目名稱:freequery,代碼行數:8,代碼來源:links.py

示例14: put

    def put(self, key, value):
        """
        Stores an out-of-band result *value* (bytes) with the key *key*.

        Key must be unique in this job.
        Maximum key length is 256 characters.
        Only characters in the set ``[a-zA-Z_\-:[email protected]]`` are allowed in the key.
        """
        from disco.ddfs import DDFS
        from disco.util import save_oob
        from disco.error import DiscoError
        if DDFS.safe_name(key) != key:
            raise DiscoError("OOB key contains invalid characters ({0})".format(key))
        save_oob(self.master, self.jobname, key, value)
開發者ID:AlexArgus,項目名稱:disco,代碼行數:14,代碼來源:task.py

示例15: __init__

 def __init__(self,
              host='',
              jobfile='',
              jobname='',
              master=None,
              disco_port=None,
              put_port=None,
              ddfs_data='',
              disco_data='',
              stage=None,
              group=None,
              grouping=None,
              taskid=-1):
     from disco.job import JobPack
     from disco.ddfs import DDFS
     self.host = host
     self.jobfile = jobfile
     self.jobname = jobname
     self.jobpack = JobPack.load(open(jobfile, 'rb'))
     self.jobobjs = dPickle.loads(self.jobpack.jobdata)
     self.master = master
     self.disco_port = disco_port
     self.put_port = put_port
     self.ddfs_data = ddfs_data
     self.disco_data = disco_data
     self.stage = stage
     self.group = '{0[0]}-{0[1]}'.format(group)
     self.group_label, self.group_host = group
     self.grouping = grouping
     self.taskid = taskid
     self.outputs = {}
     self.uid = '{0}:{1}-{2}-{3}-{4}'.format(self.stage,
                                             DDFS.safe_name(self.group),
                                             self.taskid,
                                             hexhash(str((time.time())).encode()),
                                             os.getpid())
開發者ID:AlexArgus,項目名稱:disco,代碼行數:36,代碼來源:task.py


注:本文中的disco.ddfs.DDFS類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。