コード例 #1
0
ファイル: test_pickle.py プロジェクト: yuj/disco
 def test_dpickle(self):
     now = datetime.datetime.now()
     self.assertEquals(now, loads(dumps(now)))
     self.assertEquals(666, loads(dumps(666)))
     self.assertEquals(f.__code__, loads(dumps(f)).__code__)
     self.assertEquals(f().__code__, loads(dumps(f())).__code__)
     self.assertEquals(p('a', b='b'), loads(dumps(p))('a', b='b'))
コード例 #2
0
ファイル: test_pickle.py プロジェクト: Dieterbe/disco
 def test_dpickle(self):
     now = datetime.datetime.now()
     self.assertEquals(now, loads(dumps(now)))
     self.assertEquals(666, loads(dumps(666)))
     self.assertEquals(f.func_code, loads(dumps(f)).func_code)
     self.assertEquals(f().func_code, loads(dumps(f())).func_code)
     self.assertEquals(p('a', b='b'), loads(dumps(p))('a', b='b'))
コード例 #3
0
 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())
コード例 #4
0
ファイル: task.py プロジェクト: caox/disco
 def __init__(self,
              host='',
              jobfile='',
              jobname='',
              master=None,
              disco_port=None,
              put_port=None,
              ddfs_data='',
              disco_data='',
              mode=None,
              taskid=-1):
     from disco.job import JobPack
     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.mode = mode
     self.taskid = taskid
     self.outputs = {}
     self.uid = '{0}:{1}-{2}-{3}'.format(mode,
                                         taskid,
                                         hexhash(str((time.time())).encode()),
                                         os.getpid())
コード例 #5
0
 def __init__(self,
              host='',
              jobfile='',
              jobname='',
              master=None,
              disco_port=None,
              put_port=None,
              ddfs_data='',
              disco_data='',
              mode=None,
              taskid=-1):
     from disco.job import JobPack
     self.host = host
     self.jobfile = jobfile
     self.jobname = jobname
     self.jobpack = JobPack.load(open(jobfile))
     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.mode = mode
     self.taskid = taskid
     self.outputs = {}
     self.uid = '%s:%s-%s-%x' % (mode,
                                 taskid,
                                 hexhash(str((time.time()))),
                                 os.getpid())
コード例 #6
0
ファイル: test_pickle.py プロジェクト: AlexArgus/disco
 def test_ensure_name_remains(self):
     p.__name__ = "np"
     np = loads(dumps(p))
     import sys
     if sys.version_info[0:2] != (2,6):
         self.assertTrue(hasattr(np, "__name__"))
         self.assertEqual(np.__name__, "np")
コード例 #7
0
 def test_ensure_name_remains(self):
     p.__name__ = "np"
     np = loads(dumps(p))
     import sys
     if sys.version_info[0:2] != (2, 6):
         self.assertTrue(hasattr(np, "__name__"))
         self.assertEqual(np.__name__, "np")
コード例 #8
0
ファイル: task.py プロジェクト: AlexArgus/disco
 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())
コード例 #9
0
ファイル: test_pickle.py プロジェクト: Dieterbe/disco
 def test_pattern(self):
     pattern = re.compile(r'pattern.*!')
     self.assertEquals(pattern, loads(dumps(pattern)))
コード例 #10
0
ファイル: test_pickle.py プロジェクト: yuj/disco
 def test_pattern(self):
     pattern = re.compile(r'pattern.*!')
     self.assertEquals(pattern, loads(dumps(pattern)))