However, when I have _add_launchpad_and_fw_id set to True with rlaunch multi it doesn’t seem like the usual LaunchPad attributes (e.g., host, port, launches) are accessible. Inside the Firetask, self.launchpad is a multiprocessing.managers.AutoProxy[LaunchPad] object.
Here is an example:
from fireworks.utilities.fw_utilities import explicit_serialize
from fireworks.core.firework import FireTaskBase
from fireworks import Firework, Workflow, LaunchPad
@explicit_serialize
class AddLaunchpadTask(FireTaskBase):
_fw_name = "AddLaunchpadTask"
def run_task(self, fw_spec):
host, port, name = [getattr(self.launchpad, k) for k in ('host', 'port', 'name')]
print(host, port, name)
if __name__=="__main__":
launchpad = LaunchPad()
launchpad.reset(password=None, require_password=False)
fw = Firework([AddLaunchpadTask()], spec={'_add_launchpad_and_fw_id':True})
launchpad.add_wf(fw)
launchpad.add_wf(fw)
Running ‘rlaunch rapidfire’ does not throw an error.
Running ‘rlaunch multi 2’ throws the error:
Traceback (most recent call last):
File "/Users/alexdunn/env1/lib/python2.7/site-packages/fireworks/core/rocket.py", line 224, in run
m_action = t.run_task(my_spec)
File "/Users/alexdunn/tests/add_launchpad_test_case.py", line 11, in run_task
host, port, name = [getattr(self.launchpad, k) for k in ('host', 'port', 'name')]
AttributeError: 'AutoProxy[LaunchPad]' object has no attribute 'host'
m_action = t.run_task(my_spec)
File "/Users/alexdunn/tests/add_launchpad_test_case.py", line 11, in run_task
host, port, name = [getattr(self.launchpad, k) for k in ('host', 'port', 'name')]
AttributeError: 'AutoProxy[LaunchPad]' object has no attribute 'host'
There is a class DataServer in fw_utilities.py that looks like it manages LaunchPad objects between multiple processes. I am just not sure how to get LaunchPad data from the AutoProxy[LaunchPad] object though. Has anyone else run into this issue before?
When I have _add_launchpad_and_fw_id set to True with rlaunch rapidfire or rlaunch singleshot I can access all the attributes of the LaunchPad object, such as the host with self.launchpad.host. Inside the Firetask, self.launchpad is a Fireworks.core.launchpad.LaunchPad object.