Hi, sorry to intrude,
I have two questions:
I have a “task master fireworks framework” that will load tasks and workflows to mongoDB queue.
I am planning to load tasks with params that are basically python objects and some additional params that could be combination of py objects and strings params.
Example would be:
serviceDriverObject with params like
-e scanBlah -p porjectTemplate -v (some version) 1.0.3 -a (some action) pub (debug mode) -d
serviceDriverObject is my own implementation of configpraser containing all of the relevant info that remote server needs to execute work.
I have been playing with custom firetask.
first
_fw_name =
will never be picked up from the class attribute no matter what!
In mongo all I see is module.className for _fw_name instead of custom one
second
if i do not want to use yaml fw_spec (hate yaml) in run_task or class itself what is recommended way of storing python objects for tasks?
I can use dill or any other third party library to serialize these objects if necessary prior to adding them to tasks …
in general should I opt to use pytask insted of making my own custom firetasks…
here is example of simple custom task:
@explicit_serialize
class MyTask(FiretaskBase):
“”"
Custom firetask
Args:
"""
_fw_name = 'ATask'
required_params = ["serviceDriver", "conf"]
optional_params = ['optional']
def run_task(self, fw_spec):
print(self['serviceDriver'], self['conf']) - this is str representation of module.object na conf object - not good for object good for params
#print(self.fw_spec['name']) # print the name of the Firework
return FWAction(someResult of serviceDriver)
create a complex teask
mObject = type(‘moduleObject’, (object,), {})()
mObject.doit = ‘sasha’
conf = type(‘moduleObject’, (object,), {})()
conf.somethig = ‘blah’
conf.somethingelse = 2
task3 = MyTask(serviceDriver=mObject,conf=conf)
set up the LaunchPad and reset it
launchpad = LaunchPad()
launchpad.reset(’’, require_password=False)
fw = Firework([task3])
launchpad.add_wf(fw)
launch_rocket(launchpad, FWorker())
Much appreciated, and really nice work on this project …
Regards,