The Architect Node

architect.ArchitectNode.handle_pipes(signum, frame)

Redirect stdout and stderr to os.devnull

class architect.ArchitectNodeLibs.ArchitectNode(instance_name, pyro_name, logger, monitor_timeout=30, max_threadpool_size=None)

Start, stop, and track jobs running on this node.

__init__ – register with PML beat – set _last_monitor to most recent beat from manager __monitor – track _last_monitor __is_running – !shutdownflag, for pyro_run_loop pyro_run_loop – registers with pyro and enters run loop set_log_level – set the log level get_env – get an environment variable set_env – set an environment variable get_pgrp – get process group _bind_ports – bind some unused ports _release_ports – release bound ports bind_tcp – bind to unused tcp port(s) bind_udp – bind to unused udp port(s) release_tcp – release bound tcp port(s) release_udp – release bound udp port(s) start – start a role send_input – write intput to stdin of a role poll – poll all roles and return a dictionary of results stop – stop a role kill – kill a role purge – remove a non-running role from dictionary set_log_level – set the logger level log_to_sve – start sending log messages to logger SVE __signaled_shutdown – run shutdown after a signal __shutdown – stop (or, if that fails, kill) all subprocesses and exit shutdown – start __shutdown in a thread

beat()

Set last monitor to now.

pyro_run_loop()

Connect to pyro and run the code

get_env(variable)

Return the value of an environment variable.

set_env(variable, value)

Set an environment variable.

get_pgrp()

Return the group ID of this process.

bind_tcp(num_ports=1, as_string=True)

Get some free tcp port numbers.

If as_string is False, return a list of ports numbers.
If True, return a space delimited string.
bind_udp(num_ports=1, as_string=True)

Get some free udp port numbers.

If as_string is False, return a list of ports numbers.
If True, return a space delimited string.
release_tcp(ports)

Release previously bound ports.

release_udp(ports)

Release previously bound ports.

start(role, command_as_list, product=None, version=None, setup_args=None, env_vars=None, xterm=False, xterm_args=[], eups_list=None)

Start the role using command list.

env_vars is a dictionary that will be added to the current env. eups_list must contain tuples (product, version). They will be set up in order after product setup is complete.

send_input(args, event=None)

Send a command to stdin of a role.

args are “role input”

poll(role_list=None)

Return a dictionary of running processies.

Values of None will be changed to “running”, and integers n will
be changed to “exit n”
stop(role, event=None)

Send SIGTERM to a role.

kill(role)

Send SIGKILL to a role.

This is a more extreeme version of stop.

purge(role)

If role is not running, remove from dictionary.

set_log_level(level)

Set the log level for this node.

log_to_sve()

Start sending log messages to the sve.

shutdown(reason=None)

Flag shutdown as happening and start __shutdown in a thread.

The threading is so that Pyro commands to shutdown will return,
and not confuse the Manager.