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

Replace Pyro with HTTP(S) communication layer #1923

Merged
merged 12 commits into from
Sep 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ cylc. If not, see [GNU licenses](http://www.gnu.org/licenses/).
## Acknowledgement For Non-Cylc Work:
Licences for non-cylc work included in this distribution can be found in the
`licences/` directory.
* `lib/cherrypy`:
External software library released under a BSD license.
Minor modification to ignore an import warning.
See [cherrypy](http://www.cherrypy.org).
* `lib/isodatetime/`:
Unmodified external software library released under the LGPL license.
See [metomi/isodatetime](https://github.com/metomi/isodatetime).
* `lib/Pyro/`:
External software library released under the MIT license.
Minor modification based on version 3.16.
See [Pyro 3.16](https://pypi.python.org/pypi/Pyro).
* `lib/xdot.py`:
External software released under the LGPL license.
Modifications based on version 0.6. See
Expand Down
2 changes: 1 addition & 1 deletion bin/cylc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ try:
os.getcwd()
except OSError as exc:
# The current working directory has been deleted (or filesystem
# problems of some kind...). This results in Pyro not being found,
# problems of some kind...). This results in cherrypy not being found,
# immediately below. We cannot just chdir to $HOME as gcylc does
# because that would break relative directory path command arguments
# (cylc reg SUITE PATH).
Expand Down
22 changes: 14 additions & 8 deletions bin/cylc-broadcast
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import cylc.flags
from cylc.broadcast_report import (
get_broadcast_change_report, get_broadcast_bad_options_report)
from cylc.option_parsers import CylcOptionParser as COP
from cylc.network.suite_broadcast import BroadcastClient
from cylc.network.suite_broadcast_client import BroadcastClient
from cylc.print_tree import print_tree
from cylc.task_id import TaskID
from cylc.cfgspec.suite import SPEC, upg
Expand Down Expand Up @@ -107,7 +107,7 @@ def get_rdict(left, right=None):


def main():
parser = COP(__doc__, pyro=True)
parser = COP(__doc__, comms=True)

parser.add_option(
"-t", "--tag", metavar="CYCLE_POINT",
Expand Down Expand Up @@ -192,7 +192,7 @@ def main():
pass

pclient = BroadcastClient(
suite, options.owner, options.host, options.pyro_timeout,
suite, options.owner, options.host, options.comms_timeout,
options.port, options.db, my_uuid=options.set_uuid,
print_uuid=options.print_uuid)

Expand All @@ -202,7 +202,7 @@ def main():
name, point_string = TaskID.split(options.showtask)
except ValueError:
parser.error("TASKID must be " + TaskID.SYNTAX)
settings = pclient.broadcast('get', options.showtask)
settings = pclient.broadcast('get', task_id=options.showtask)
padding = get_padding(settings) * ' '
if options.raw:
print str(settings)
Expand All @@ -212,15 +212,17 @@ def main():

if options.clear:
modified_settings, bad_options = pclient.broadcast(
'clear', options.point_strings, options.namespaces)
'clear', point_strings=options.point_strings,
namespaces=options.namespaces
)
if modified_settings:
print get_broadcast_change_report(
modified_settings, is_cancel=True)
sys.exit(get_broadcast_bad_options_report(bad_options))

if options.expire:
modified_settings, bad_options = pclient.broadcast(
'expire', options.expire)
'expire', cutoff=options.expire)
if modified_settings:
print get_broadcast_change_report(
modified_settings, is_cancel=True)
Expand Down Expand Up @@ -249,7 +251,9 @@ def main():
validate(setting, SPEC['runtime']['__MANY__'])
settings.append(setting)
modified_settings, bad_options = pclient.broadcast(
'clear', point_strings, namespaces, settings)
'clear', point_strings=point_strings,
namespaces=namespaces, cancel_settings=settings
)
if modified_settings:
print get_broadcast_change_report(
modified_settings, is_cancel=True)
Expand All @@ -270,7 +274,9 @@ def main():
validate(setting, SPEC['runtime']['__MANY__'])
settings.append(setting)
modified_settings, bad_options = pclient.broadcast(
'put', point_strings, namespaces, settings)
'put', point_strings=point_strings,
namespaces=namespaces, settings=settings
)
print get_broadcast_change_report(modified_settings)
sys.exit(get_broadcast_bad_options_report(bad_options, is_set=True))

Expand Down
6 changes: 3 additions & 3 deletions bin/cylc-dump
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ if '--use-ssh' in sys.argv[1:]:
sys.exit(0)

import cylc.flags
from cylc.network.suite_state import StateSummaryClient
from cylc.option_parsers import CylcOptionParser as COP
from cylc.network.suite_state_client import StateSummaryClient
from cylc.dump import dump_to_stdout


def main():
parser = COP(__doc__, pyro=True, noforce=True)
parser = COP(__doc__, comms=True, noforce=True)

parser.add_option(
"-g", "--global", help="Global information only.",
Expand Down Expand Up @@ -78,7 +78,7 @@ def main():

try:
pclient = StateSummaryClient(
suite, options.owner, options.host, options.pyro_timeout,
suite, options.owner, options.host, options.comms_timeout,
options.port, options.db, my_uuid=options.set_uuid,
print_uuid=options.print_uuid)
# get state summary, task names, cycle points
Expand Down
6 changes: 3 additions & 3 deletions bin/cylc-ext-trigger
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ import sys

import cylc.flags
from cylc.option_parsers import CylcOptionParser as COP
from cylc.network.ext_trigger import ExtTriggerClient
from cylc.network.ext_trigger_client import ExtTriggerClient


def main():
parser = COP(
__doc__, pyro=True,
__doc__, comms=True,
argdoc=[("REG", "Suite name"),
("MSG", "External trigger message"),
("ID", "Unique trigger ID")])
Expand All @@ -70,7 +70,7 @@ def main():
print 'Send to suite %s: "%s" (%s)' % (suite, event_msg, event_id)

pclient = ExtTriggerClient(
suite, options.owner, options.host, options.pyro_timeout,
suite, options.owner, options.host, options.comms_timeout,
options.port, options.db, my_uuid=options.set_uuid,
print_uuid=options.print_uuid)

Expand Down
6 changes: 3 additions & 3 deletions bin/cylc-get-suite-version
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ if '--use-ssh' in sys.argv[1:]:
import cylc.flags
from cylc.option_parsers import CylcOptionParser as COP
from cylc.task_id import TaskID
from cylc.network.suite_info import SuiteInfoClient
from cylc.network.suite_info_client import SuiteInfoClient
from cylc.cfgspec.globalcfg import GLOBAL_CFG


def main():
parser = COP(__doc__, pyro=True, argdoc=[('REG', 'Suite name')])
parser = COP(__doc__, comms=True, argdoc=[('REG', 'Suite name')])

(options, args) = parser.parse_args()
suite = args[0]

pclient = SuiteInfoClient(
suite, options.owner, options.host, options.pyro_timeout,
suite, options.owner, options.host, options.comms_timeout,
options.port, options.db, my_uuid=options.set_uuid,
print_uuid=options.print_uuid)
print pclient.get_info('get_cylc_version')
Expand Down
12 changes: 5 additions & 7 deletions bin/cylc-gui
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def main():
sys.path.append(
os.path.dirname(os.path.realpath(os.path.abspath(__file__))) + '/../')

parser = COP(__doc__, pyro=True, noforce=True, jset=True,
parser = COP(__doc__, comms=True, noforce=True, jset=True,
argdoc=[('[REG]', 'Suite name')])

parser.add_option(
Expand All @@ -78,11 +78,9 @@ def main():
warnings.filterwarnings('ignore', 'use the new', Warning)
from cylc.gui.app_gcylc import ControlApp

# Make current working directory be $HOME. Otherwise (1) if the user
# attempts to start gcylc from a CWD that has been removed, Pyro will
# not be importable below; and (2) if the CWD gets removed later while
# gcylc is running, subprocesses spawned by gcylc will fail when they
# attempt to determine their CWD.
# Make current working directory be $HOME. Otherwise if the CWD gets
# removed later while gcylc is running, subprocesses spawned by gcylc will
# fail when they attempt to determine their CWD.
os.chdir(os.environ['HOME'])

gtk.settings_get_default().set_long_property(
Expand All @@ -98,7 +96,7 @@ def main():
suite = None
app = ControlApp(
suite, options.db, options.owner, options.host,
options.port, options.pyro_timeout,
options.port, options.comms_timeout,
load_template_vars(options.templatevars, options.templatevars_file),
options.restricted)
gtk.main()
Expand Down
14 changes: 8 additions & 6 deletions bin/cylc-hold
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ if '--use-ssh' in sys.argv[1:]:

import cylc.flags
from cylc.prompt import prompt
from cylc.network.suite_command import SuiteCommandClient
from cylc.option_parsers import CylcOptionParser as COP
from cylc.network.suite_command_client import SuiteCommandClient


def main():
parser = COP(
__doc__, pyro=True, multitask=True,
__doc__, comms=True, multitask=True,
argdoc=[
("REG", "Suite name"),
('[TASKID ...]', 'Task identifiers')])
Expand All @@ -62,15 +62,17 @@ def main():
else:
prompt('Hold suite %s' % suite, options.force)
pclient = SuiteCommandClient(
suite, options.owner, options.host, options.pyro_timeout,
suite, options.owner, options.host, options.comms_timeout,
options.port, options.db, my_uuid=options.set_uuid,
print_uuid=options.print_uuid)
if args:
items, compat = parser.parse_multitask_compat(options, args)
pclient.put_command('hold_task', items, compat)
items = parser.parse_multitask_compat(options, args)
pclient.put_command('hold_tasks', items=items)
elif options.hold_point_string:
pclient.put_command(
'hold_after_point_string', options.hold_point_string)
'hold_after_point_string',
point_string=options.hold_point_string
)
else:
pclient.put_command('hold_suite')

Expand Down
17 changes: 9 additions & 8 deletions bin/cylc-insert
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ if '--use-ssh' in sys.argv[1:]:

import cylc.flags
from cylc.prompt import prompt
from cylc.network.suite_command import SuiteCommandClient
from cylc.option_parsers import CylcOptionParser as COP
from cylc.network.suite_command_client import SuiteCommandClient
from cylc.task_id import TaskID


def main():
parser = COP(
__doc__, pyro=True, multitask=True,
__doc__, comms=True, multitask=True,
argdoc=[
("REG", "Suite name"),
('TASKID [...]', 'Task identifier')])
Expand All @@ -68,27 +68,28 @@ def main():
if (options.multitask_compat and len(args) in [2, 3] and
all(["/" not in arg for arg in args]) and
all(["." not in arg for arg in args[1:]])):
items, compat = (args[0], args[1])
items = [(args[0] + "." + args[1])]
if len(args) == 3:
options.stop_point_string = args[2]
prompt(
'Insert %s at %s in %s' % (items, compat, suite),
options.force)
'Insert %s in %s' % (items, suite), options.force)
else:
items, compat = (args, None)
items = args
for i, item in enumerate(items):
if not TaskID.is_valid_id_for_insert(item):
sys.exit('ERROR: "%s": invalid task ID (argument %d)' % (
item, i + 1))
prompt('Insert %s in %s' % (items, suite), options.force)

pclient = SuiteCommandClient(
suite, options.owner, options.host, options.pyro_timeout,
suite, options.owner, options.host, options.comms_timeout,
options.port, options.db, my_uuid=options.set_uuid,
print_uuid=options.print_uuid)

pclient.put_command(
'insert_task', items, compat, None, options.stop_point_string)
'insert_tasks', items=items,
stop_point_string=options.stop_point_string
)


if __name__ == "__main__":
Expand Down
10 changes: 5 additions & 5 deletions bin/cylc-kill
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ if '--use-ssh' in sys.argv[1:]:

import cylc.flags
from cylc.prompt import prompt
from cylc.network.suite_command import SuiteCommandClient
from cylc.option_parsers import CylcOptionParser as COP
from cylc.network.suite_command_client import SuiteCommandClient


def main():
parser = COP(
__doc__, pyro=True, multitask=True,
__doc__, comms=True, multitask=True,
argdoc=[
('REG', 'Suite name'),
('[TASKID ...]', 'Task identifiers')])
Expand All @@ -52,11 +52,11 @@ def main():
else:
prompt('Kill ALL tasks in %s' % (suite), options.force)
pclient = SuiteCommandClient(
suite, options.owner, options.host, options.pyro_timeout,
suite, options.owner, options.host, options.comms_timeout,
options.port, options.db, my_uuid=options.set_uuid,
print_uuid=options.print_uuid)
items, compat = parser.parse_multitask_compat(options, args)
pclient.put_command('kill_tasks', items, compat)
items = parser.parse_multitask_compat(options, args)
pclient.put_command('kill_tasks', items=items)


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions bin/cylc-monitor
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ from time import sleep

from parsec.OrderedDict import OrderedDict
from cylc.option_parsers import CylcOptionParser as COP
from cylc.network.suite_state import (
from cylc.network.suite_state_client import (
SUITE_STATUS_SPLIT_REC, get_suite_status_string, StateSummaryClient,
SuiteStillInitialisingError)
from cylc.wallclock import get_time_string_from_unix_time
Expand All @@ -50,7 +50,7 @@ class SuiteMonitor(object):
"""cylc [info] monitor [OPTIONS] ARGS

A terminal-based live suite monitor. Exit with 'Ctrl-C'.""",
pyro=True, noforce=True)
comms=True, noforce=True)

self.parser.add_option(
"-a", "--align",
Expand Down Expand Up @@ -107,7 +107,7 @@ A terminal-based live suite monitor. Exit with 'Ctrl-C'.""",
len_header = sum(len(s) for s in TASK_STATUSES_ORDERED)

self.pclient = StateSummaryClient(
suite, options.owner, options.host, options.pyro_timeout,
suite, options.owner, options.host, options.comms_timeout,
options.port, options.db)

while True:
Expand Down
6 changes: 3 additions & 3 deletions bin/cylc-nudge
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ if '--use-ssh' in sys.argv[1:]:
sys.exit(0)

import cylc.flags
from cylc.network.suite_command import SuiteCommandClient
from cylc.option_parsers import CylcOptionParser as COP
from cylc.network.suite_command_client import SuiteCommandClient


def main():
parser = COP(__doc__, pyro=True)
parser = COP(__doc__, comms=True)

(options, args) = parser.parse_args()
suite = args[0]

pclient = SuiteCommandClient(
suite, options.owner, options.host, options.pyro_timeout,
suite, options.owner, options.host, options.comms_timeout,
options.port, options.db, my_uuid=options.set_uuid,
print_uuid=options.print_uuid)

Expand Down
Loading