def METHOD_NAME(context, timeout_s):
    timeout_s = int(timeout_s or 30)
    timeout = time.monotonic() + timeout_s
    ready = False
    while not ready and time.monotonic() < timeout:
        try:
            log = slurp_file('naemon.log')
            # When we see this line in the log, we'll wait 1 more second and
            # then Naemon should be ready, with signal handlers setup so that a
            # test can SIGTERM it.
            if 'Successfully launched command file worker with pid' in log:
                ready = True
                time.sleep(1)
                break
        except OSError:
            pass
        time.sleep(1)
    assert ready, "Naemon did not start within %d seconds" % timeout_s