Skip to content

Mitogen with Molecule? #467

Closed
Closed
@dsgnr

Description

@dsgnr

This is possibly pushing the boundaries and no way did I expect this to work, but thought why not try?!

I was attempting to implement Mitogen with Molecule so that the checks etc run quicker.

Here's my molecule.yml:

---
driver:
  name: docker
lint:
  name: yamllint
dependency:
  name: shell
  command: mkdir -p /tmp/molecule/plugins && git clone https://github.com/dw/mitogen.git /tmp/molecule/plugins/mitogen
platforms:
  - name: molecule-centos7
    image: centos:7
  - name: molecule-ubuntu1604
    image: ubuntu:xenial
  - name: molecule-ubuntu1804
    image: ubuntu:bionic
provisioner:
  name: ansible
  config_options:
    defaults:
      strategy_plugins: /tmp/molecule/plugins/mitogen/ansible_mitogen/plugins/strategy
      strategy: mitogen_linear
    ssh_connection:
      pipelining: true
      ssh_args: -o ControlMaster=auto -o ControlPersist=60s
  lint:
    name: ansible-lint
scenario:
  name: default
verifier:
  name: testinfra
  lint:
    name: flake8

Now, it does seem to work through molecule test but there is an error being presented. As this is not exactly a typical use case, I'm not expecting anything from it, rather just querying what this is:

    TASK [Wait for instance(s) deletion to complete] *******************************
    FAILED - RETRYING: Wait for instance(s) deletion to complete (300 retries left).
ERROR! [pid 114126] 13:44:11.383913 E mitogen.ctx.local.114148: mitogen: RouteMonitor(): received DEL_ROUTE for 1004 from mitogen.fork.Stream(u'fork.114151'), expected mitogen.core.Stream('parent')
ERROR! [pid 114126] 13:44:11.399392 E mitogen.ctx.local.114148: mitogen: RouteMonitor(): received DEL_ROUTE for 1003 from mitogen.fork.Stream(u'fork.114151'), expected mitogen.core.Stream('parent')
ERROR! [pid 114126] 13:44:11.437268 E mitogen.ctx.local.114148: mitogen: RouteMonitor(): received DEL_ROUTE for 1005 from mitogen.fork.Stream(u'fork.114151'), expected mitogen.core.Stream('parent')
    changed: [localhost] => (item=None)
    changed: [localhost] => (item=None)
    changed: [localhost] => (item=None)
    changed: [localhost]


_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cls = <class 'ansible_mitogen.process.MuxProcess'>

    @classmethod
    def start(cls):
        """
        Arrange for the subprocess to be started, if it is not already running.
    
        The parent process picks a UNIX socket path the child will use prior to
        fork, creates a socketpair used essentially as a semaphore, then blocks
        waiting for the child to indicate the UNIX socket is ready for use.
        """
        if cls.worker_sock is not None:
            return
    
        if faulthandler is not None:
            faulthandler.enable()
    
        setup_gil()
        cls.unix_listener_path = mitogen.unix.make_socket_path()
        cls.worker_sock, cls.child_sock = socket.socketpair()
        atexit.register(lambda: clean_shutdown(cls.worker_sock))
        mitogen.core.set_cloexec(cls.worker_sock.fileno())
        mitogen.core.set_cloexec(cls.child_sock.fileno())
    
        if os.environ.get('MITOGEN_PROFILING'):
            mitogen.core.enable_profiling()
    
        cls.original_env = dict(os.environ)
        cls.child_pid = os.fork()
        ansible_mitogen.logging.setup()
        if cls.child_pid:
            cls.child_sock.close()
            cls.child_sock = None
            mitogen.core.io_op(cls.worker_sock.recv, 1)
        else:
            cls.worker_sock.close()
            cls.worker_sock = None
            self = cls()
            self.worker_main()
>           sys.exit()
E           SystemExit

/tmp/molecule/plugins/mitogen/ansible_mitogen/process.py:193: SystemExit
====================== 1 failed, 2 passed in 5.58 seconds ======================

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugCode feature that hinders desired execution outcomeuser-reported

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions