Invert the sense of mitogen.slave

pull/35/head
David Wilson 8 years ago
parent 84707866b9
commit 9aec5a1ccf

@ -300,7 +300,7 @@ usual into the slave process.
context = mitogen.ssh.connect(broker, sys.argv[1])
context.call(install_app)
if __name__ == '__main__' and not mitogen.slave:
if __name__ == '__main__' and mitogen.master:
import mitogen.utils
mitogen.utils.run_with_broker(main)

@ -3,7 +3,7 @@ On the Mitogen master, this is imported from ``mitogen/__init__.py`` as would
be expected. On the slave, it is built dynamically during startup.
"""
#: This is ``True`` in slave contexts. It is used in single-file Python
#: This is ``False`` in slave contexts. It is used in single-file Python
#: programs to avoid reexecuting the program's :py:func:`main` function in the
#: slave. For example:
#:
@ -16,11 +16,11 @@ be expected. On the slave, it is built dynamically during startup.
#: context = mitogen.master.connect(broker)
#: context.call(do_work) # Causes slave to import __main__.
#:
#: if __name__ == '__main__' and not mitogen.slave:
#: if __name__ == '__main__' and mitogen.master:
#: import mitogen.utils
#: mitogen.utils.run_with_broker(main)
#:
slave = False
master = True
#: This is ``0`` in a master, otherwise it is a master-generated ID unique to

@ -1085,7 +1085,7 @@ class ExternalContext(object):
mitogen.__package__ = 'mitogen'
mitogen.__path__ = []
mitogen.__loader__ = self.importer
mitogen.slave = True
mitogen.master = False
mitogen.context_id = context_id
mitogen.parent_id = parent_id
mitogen.core = sys.modules['__main__']

Loading…
Cancel
Save