Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix suite info on daemonize #2044

Merged
merged 2 commits into from
Oct 31, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
daemonize fork 1 poll timeout after 5 minutes
  • Loading branch information
matthewrmshin committed Oct 27, 2016
commit e6f1f792f25548c512c9eebf60b4f55a9c1faf23
10 changes: 8 additions & 2 deletions lib/cylc/daemonize.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import os
import sys
from time import sleep
from time import sleep, time
from cylc.suite_logging import SuiteLog


Expand All @@ -42,6 +42,8 @@
+ Port: %(port)s
+ Logs: %(logd)s/{log,out,err}""" + SUITE_SCAN_INFO_TMPL

_TIMEOUT = 300.0 # 5 minutes


def redirect(logd):
"""Redirect standard file descriptors
Expand Down Expand Up @@ -81,7 +83,9 @@ def daemonize(server):
# Poll for suite log to be populated
suite_pid = None
suite_port = None
while suite_pid is None or suite_port is None:
timeout = time() + _TIMEOUT
while time() <= timeout and (
suite_pid is None or suite_port is None):
sleep(0.1)
try:
log_stat = os.stat(log_fname)
Expand All @@ -106,6 +110,8 @@ def daemonize(server):
sys.exit("Suite daemon exited")
except (IOError, OSError, ValueError):
pass
if suite_pid is None or suite_port is None:
sys.exit("Suite not started after %ds" % _TIMEOUT)
# Print suite information
sys.stdout.write(_INFO_TMPL % {
"suite": server.suite,
Expand Down