def create_instance(self): return Celery(self.wf_spec, 'testtask', 'call.name', call_args=[Attrib('the_attribute'), 1], description='foo', named_kw=[], dict_kw={})
def testSerializationWithoutKwargs(self): new_wf_spec = WorkflowSpec() serializer = DictionarySerializer() nokw = Celery(self.wf_spec, "testnokw", "call.name", call_args=[Attrib("the_attribute"), 1]) data = nokw.serialize(serializer) nokw2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertDictEqual(nokw.kwargs, nokw2.kwargs) kw = Celery( self.wf_spec, "testkw", "call.name", call_args=[Attrib("the_attribute"), 1], some_arg={"key": "value"} ) data = kw.serialize(serializer) kw2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertDictEqual(kw.kwargs, kw2.kwargs) # Has kwargs, but they belong to TaskSpec kw_defined = Celery( self.wf_spec, "testkwdef", "call.name", call_args=[Attrib("the_attribute"), 1], some_ref=Attrib("value"), defines={"key": "value"}, ) data = kw_defined.serialize(serializer) kw_defined2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertIsInstance(kw_defined2.kwargs["some_ref"], Attrib) args = [b64encode(pickle.dumps(v)) for v in [Attrib("the_attribute"), "ip", "dc455016e2e04a469c01a866f11c0854"]] data = {"R": b64encode(pickle.dumps("1"))} # Comes from live data. Bug not identified, but there we are... data = { "inputs": ["Wait:1"], "lookahead": 2, "description": "", "outputs": [], "args": args, "manual": False, "data": data, "locks": [], "pre_assign": [], "call": "call.x", "internal": False, "post_assign": [], "id": 8, "result_key": None, "defines": data, "class": "SpiffWorkflow.specs.Celery.Celery", "name": "RS1:1", } Celery.deserialize(serializer, new_wf_spec, data)
def testSerializationWithoutKwargs(self): new_wf_spec = WorkflowSpec() serializer = DictionarySerializer() nokw = Celery(self.wf_spec, 'testnokw', 'call.name', call_args=[Attrib('the_attribute'), 1]) data = nokw.serialize(serializer) nokw2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertDictEqual(nokw.kwargs, nokw2.kwargs) kw = Celery(self.wf_spec, 'testkw', 'call.name', call_args=[Attrib('the_attribute'), 1], some_arg={"key": "value"}) data = kw.serialize(serializer) kw2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertDictEqual(kw.kwargs, kw2.kwargs) # Has kwargs, but they belong to TaskSpec kw_defined = Celery(self.wf_spec, 'testkwdef', 'call.name', call_args=[Attrib('the_attribute'), 1], some_ref=Attrib('value'), defines={"key": "value"}) data = kw_defined.serialize(serializer) kw_defined2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertIsInstance(kw_defined2.kwargs['some_ref'], Attrib) # Comes from live data. Bug not identified, but there we are... data = { u'inputs': [u'Wait:1'], u'lookahead': 2, u'description': u'', u'outputs': [], u'args': [[u'Attrib', u'ip'], [u'spiff:value', u'dc455016e2e04a469c01a866f11c0854']], u'manual': False, u'properties': { u'R': u'1' }, u'locks': [], u'pre_assign': [], u'call': u'call.x', u'internal': False, u'post_assign': [], u'id': 8, u'result_key': None, u'defines': { u'R': u'1' }, u'class': u'SpiffWorkflow.specs.Celery.Celery', u'name': u'RS1:1' } Celery.deserialize(serializer, new_wf_spec, data)
def testSerializationWithoutKwargs(self): new_wf_spec = WorkflowSpec() serializer = DictionarySerializer() nokw = Celery(self.wf_spec, 'testnokw', 'call.name', call_args=[Attrib('the_attribute'), 1]) data = nokw.serialize(serializer) nokw2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertDictEqual(nokw.kwargs, nokw2.kwargs) kw = Celery(self.wf_spec, 'testkw', 'call.name', call_args=[Attrib('the_attribute'), 1], some_arg={"key": "value"}) data = kw.serialize(serializer) kw2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertDictEqual(kw.kwargs, kw2.kwargs) # Has kwargs, but they belong to TaskSpec kw_defined = Celery(self.wf_spec, 'testkwdef', 'call.name', call_args=[Attrib('the_attribute'), 1], some_ref=Attrib('value'), defines={"key": "value"}) data = kw_defined.serialize(serializer) kw_defined2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertIsInstance(kw_defined2.kwargs['some_ref'], Attrib) args = [b64encode(pickle.dumps(v)) for v in [Attrib('the_attribute'), 'ip', 'dc455016e2e04a469c01a866f11c0854']] data = {'R': b64encode(pickle.dumps('1'))} # Comes from live data. Bug not identified, but there we are... data = {'inputs': ['Wait:1'], 'lookahead': 2, 'description': '', 'outputs': [], 'args': args, 'manual': False, 'data': data, 'locks': [], 'pre_assign': [], 'call': 'call.x', 'internal': False, 'post_assign': [], 'id': 8, 'result_key': None, 'defines': data, 'class': 'SpiffWorkflow.specs.Celery.Celery', 'name': 'RS1:1'} Celery.deserialize(serializer, new_wf_spec, data)
def testSerializationWithoutKwargs(self): new_wf_spec = WorkflowSpec() serializer = DictionarySerializer() nokw = Celery(self.wf_spec, 'testnokw', 'call.name', call_args=[Attrib('the_attribute'), 1]) data = nokw.serialize(serializer) nokw2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertDictEqual(nokw.kwargs, nokw2.kwargs) kw = Celery(self.wf_spec, 'testkw', 'call.name', call_args=[Attrib('the_attribute'), 1], some_arg={"key": "value"}) data = kw.serialize(serializer) kw2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertDictEqual(kw.kwargs, kw2.kwargs) # Has kwargs, but they belong to TaskSpec kw_defined = Celery(self.wf_spec, 'testkwdef', 'call.name', call_args=[Attrib('the_attribute'), 1], some_ref=Attrib('value'), defines={"key": "value"}) data = kw_defined.serialize(serializer) kw_defined2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertIsInstance(kw_defined2.kwargs['some_ref'], Attrib) args = [ b64encode(pickle.dumps(v)) for v in [ Attrib('the_attribute'), 'ip', 'dc455016e2e04a469c01a866f11c0854' ] ] data = {'R': b64encode(pickle.dumps('1'))} # Comes from live data. Bug not identified, but there we are... data = { 'inputs': ['Wait:1'], 'lookahead': 2, 'description': '', 'outputs': [], 'args': args, 'manual': False, 'data': data, 'locks': [], 'pre_assign': [], 'call': 'call.x', 'internal': False, 'post_assign': [], 'id': 8, 'result_key': None, 'defines': data, 'class': 'SpiffWorkflow.specs.Celery.Celery', 'name': 'RS1:1' } Celery.deserialize(serializer, new_wf_spec, data)
def testSerializationWithoutKwargs(self): new_wf_spec = WorkflowSpec() serializer = DictionarySerializer() nokw = Celery(self.wf_spec, 'testnokw', 'call.name', call_args=[Attrib('the_attribute'), 1]) data = nokw.serialize(serializer) nokw2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertDictEqual(nokw.kwargs, nokw2.kwargs) kw = Celery(self.wf_spec, 'testkw', 'call.name', call_args=[Attrib('the_attribute'), 1], some_arg={"key": "value"}) data = kw.serialize(serializer) kw2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertDictEqual(kw.kwargs, kw2.kwargs) # Has kwargs, but they belong to TaskSpec kw_defined = Celery(self.wf_spec, 'testkwdef', 'call.name', call_args=[Attrib('the_attribute'), 1], some_ref=Attrib('value'), defines={"key": "value"}) data = kw_defined.serialize(serializer) kw_defined2 = Celery.deserialize(serializer, new_wf_spec, data) self.assertIsInstance(kw_defined2.kwargs['some_ref'], Attrib) # Comes from live data. Bug not identified, but there we are... data = {u'inputs': [u'Wait:1'], u'lookahead': 2, u'description': u'', u'outputs': [], u'args': [[u'Attrib', u'ip'], [u'spiff:value', u'dc455016e2e04a469c01a866f11c0854']], u'manual': False, u'properties': {u'R': u'1'}, u'locks': [], u'pre_assign': [], u'call': u'call.x', u'internal': False, u'post_assign': [], u'id': 8, u'result_key': None, u'defines': {u'R': u'1'}, u'class': u'SpiffWorkflow.specs.Celery.Celery', u'name': u'RS1:1'} Celery.deserialize(serializer, new_wf_spec, data)