Beispiel #1
0
 def _reconnect(self):
     """Connect to the suite daemon and get Pyro client proxies."""
     self.god = None
     self.sinfo = None
     self.log = None
     try:
         client = cylc_pyro_client.client(
                 self.cfg.suite,
                 self.cfg.pphrase,
                 self.cfg.owner,
                 self.cfg.host,
                 self.cfg.pyro_timeout,
                 self.cfg.port )
         self.god = client.get_proxy( 'state_summary' )
         self.sinfo = client.get_proxy( 'suite-info' )
         self.log = client.get_proxy( 'log' )
         self._retrieve_hierarchy_info()
     except Exception, x:
         # (port file not found, if suite not running)
         if self.stop_summary is None:
             self.stop_summary = dump.get_stop_state_summary(
                                                    self.cfg.suite,
                                                    self.cfg.owner,
                                                    self.cfg.host)
             self._flag_new_update()
         return False
Beispiel #2
0
    def reconnect( self ):
        try:
            client = cylc_pyro_client.client(
                    self.cfg.suite,
                    self.cfg.pphrase,
                    self.cfg.owner,
                    self.cfg.host,
                    self.cfg.pyro_timeout,
                    self.cfg.port )
            self.god = client.get_proxy( 'state_summary' )
            self.sinfo = client.get_proxy( 'suite-info' )

            # on reconnection retrieve static info
            self.ancestors = self.sinfo.get( 'first-parent ancestors' )
            self.families = self.sinfo.get( 'first-parent descendants' )
            self.allowed_families = self.sinfo.get( 'vis families' )
        except:
            if self.stop_summary is None:
                self.stop_summary = dump.get_stop_state_summary(
                                                       self.cfg.suite,
                                                       self.cfg.owner,
                                                       self.cfg.host)
                if self.stop_summary is not None and any(self.stop_summary):
                    self.info_bar.set_stop_summary(self.stop_summary)
            return False
        else:
            self.stop_summary = None
            self.status = "connected"
            self.poll_schd.stop()
            return True
Beispiel #3
0
 def _reconnect( self ):
     try:
         client = cylc_pyro_client.client(
                 self.cfg.suite,
                 self.cfg.pphrase,
                 self.cfg.owner,
                 self.cfg.host,
                 self.cfg.pyro_timeout,
                 self.cfg.port )
         self.god = client.get_proxy( 'state_summary' )
         self.sinfo = client.get_proxy( 'suite-info' )
         self.log = client.get_proxy( 'log' )
         # on reconnection retrieve static info
         self.ancestors = self.sinfo.get('first-parent ancestors' )
         self.ancestors_pruned = self.sinfo.get( 'first-parent ancestors', True )
         self.descendants = self.sinfo.get( 'first-parent descendants' )
         self.all_families = self.sinfo.get( 'all families' )
         self.triggering_families = self.sinfo.get( 'triggering families' )
         self.live_graph_movie, self.live_graph_dir = self.sinfo.get( 'do live graph movie' )
     except Exception, x:
         #print str(x) # (port file not found, if suite not running)
         if self.stop_summary is None:
             self.stop_summary = dump.get_stop_state_summary(
                                                    self.cfg.suite,
                                                    self.cfg.owner,
                                                    self.cfg.host)
             self._flag_new_update()
         return False
Beispiel #4
0
    def reconnect( self ):
        # set debug here to see how reconnection works
        debug = False
        try:
            client = cylc_pyro_client.client(
                    self.cfg.suite,
                    self.cfg.pphrase,
                    self.cfg.owner,
                    self.cfg.host,
                    self.cfg.pyro_timeout,
                    self.cfg.port )
            self.god = client.get_proxy( 'state_summary' )
            self.sinfo = client.get_proxy( 'suite-info' )

            # on reconnection retrieve static info
            self.descendants = self.sinfo.get('first-parent descendants' )
            self.ancestors = self.sinfo.get('first-parent ancestors' )
        except:
            # connection lost
            if debug:
                print ".",
            if self.stop_summary is None:
                self.stop_summary = dump.get_stop_state_summary(
                                                       self.cfg.suite,
                                                       self.cfg.owner,
                                                       self.cfg.host)
                if self.stop_summary is not None and any(self.stop_summary):
                    self.info_bar.set_stop_summary(self.stop_summary)
            return False
        else:
            self.stop_summary = None
            self.status = "connected"
            self.poll_schd.stop()
            self.info_bar.set_status( self.status )
            return True
Beispiel #5
0
 def _reconnect( self ):
     try:
         client = cylc_pyro_client.client(
                 self.cfg.suite,
                 self.cfg.pphrase,
                 self.cfg.owner,
                 self.cfg.host,
                 self.cfg.pyro_timeout,
                 self.cfg.port )
         self.god = client.get_proxy( 'state_summary' )
         self.sinfo = client.get_proxy( 'suite-info' )
         self.log = client.get_proxy( 'log' )
         # on reconnection retrieve static info
         self.ancestors = self.sinfo.get('first-parent ancestors' )
         self.ancestors_pruned = self.sinfo.get( 'first-parent ancestors', True )
         self.descendants = self.sinfo.get( 'first-parent descendants' )
         self.all_families = self.sinfo.get( 'all families' )
         self.triggering_families = self.sinfo.get( 'triggering families' )
         self.live_graph_movie, self.live_graph_dir = self.sinfo.get( 'do live graph movie' )
     except Exception, x:
         #print str(x) # (port file not found, if suite not running)
         if self.stop_summary is None:
             self.stop_summary = dump.get_stop_state_summary(
                                                    self.cfg.suite,
                                                    self.cfg.owner,
                                                    self.cfg.host)
             self._flag_new_update()
         return False
Beispiel #6
0
def get_unscannable_suite_info(host, suite, owner=None):
    """Return a map like cylc scan --raw for states and last update time."""
    summaries = get_stop_state_summary(cat_state(suite, host, owner))
    suite_info = {}
    if summaries is None:
        return suite_info
    global_summary, task_summary = summaries
    for item in task_summary.values():
        # Note: item['label'] equivalent to item['point']
        for states_point in (KEY_STATES, KEY_STATES + ":" + item['label']):
            suite_info.setdefault(states_point, {})
            suite_info[states_point].setdefault(item['state'], 0)
            suite_info[states_point][item['state']] += 1
    suite_info[KEY_UPDATE_TIME] = global_summary["last_updated"]
    return suite_info
Beispiel #7
0
def get_unscannable_suite_info(host, suite, owner=None):
    """Return a map like cylc scan --raw for states and last update time."""
    summaries = get_stop_state_summary(cat_state(suite, host, owner))
    suite_info = {}
    if summaries is None:
        return suite_info
    global_summary, task_summary = summaries
    for item in task_summary.values():
        # Note: item['label'] equivalent to item['point']
        for states_point in (KEY_STATES, KEY_STATES + ":" + item['label']):
            suite_info.setdefault(states_point, {})
            suite_info[states_point].setdefault(item['state'], 0)
            suite_info[states_point][item['state']] += 1
    suite_info[KEY_UPDATE_TIME] = global_summary["last_updated"]
    return suite_info
Beispiel #8
0
    def reconnect( self ):

        self.prev_graph_id = ()
        try:
            client = cylc_pyro_client.client( 
                    self.cfg.suite,
                    self.cfg.pphrase,
                    self.cfg.owner,
                    self.cfg.host,
                    self.cfg.pyro_timeout,
                    self.cfg.port )
            self.god = client.get_proxy( 'state_summary' )
            self.sinfo = client.get_proxy( 'suite-info' )

            # on reconnection retrieve static info
            self.family_nodes = self.sinfo.get( 'family nodes' )
            self.graphed_family_nodes = self.sinfo.get( 'graphed family nodes' )
            self.descendants = self.sinfo.get( 'first-parent descendants' )
            self.ancestors = self.sinfo.get('first-parent ancestors' )
            self.live_graph_movie, self.live_graph_dir = self.sinfo.get( 'do live graph movie' )
        except:
            # connection lost
            if self.stop_summary is None:
                self.stop_summary = dump.get_stop_state_summary(
                                                            self.cfg.suite,
                                                            self.cfg.owner,
                                                            self.cfg.host)
                if self.stop_summary is not None and any(self.stop_summary):
                    self.info_bar.set_stop_summary(self.stop_summary)
            return False
        else: 
            self.stop_summary = None
            self.status = "connected"
            self.first_update = True
            self.info_bar.set_status( self.status )
            if self.live_graph_movie:
                try:
                    mkdir_p( self.live_graph_dir )
                except Exception, x:
                    print >> sys.stderr, x
                    print >> sys.stderr, "Disabling live graph movie"
                    self.live_graph_movie = False
            self.first_update = True
            self.status = "connected"
            self.poll_schd.stop()
            self.info_bar.set_status( self.status )
            return True
Beispiel #9
0
    def set_stopped(self):
        """Reset data and clients when suite is stopped."""
        if cylc.flags.debug:
            sys.stderr.write("%s NOT CONNECTED\n" % get_current_time_string())
        self.full_mode = True
        self.connected = False
        self.set_status(SUITE_STATUS_STOPPED)
        self.update_interval += 1.0
        if self.update_interval > self.max_update_interval:
            self.update_interval = self.max_update_interval
        self.state_summary = {}
        self.full_state_summary = {}
        self.fam_state_summary = {}
        self.full_fam_state_summary = {}
        self.all_families = {}
        self.global_summary = {}
        self.cfg.port = None
        self.client = None

        gobject.idle_add(self.app_window.set_title, str(self.cfg.suite))

        # Use info bar to display stop summary if available.
        # Otherwise, just display the reconnect count down.
        if self.cfg.suite and self.stop_summary is None:
            stop_summary = get_stop_state_summary(
                cat_state(self.cfg.suite, self.cfg.host, self.cfg.owner))
            if stop_summary != self.stop_summary:
                self.stop_summary = stop_summary
                self.status = SUITE_STATUS_STOPPED
                gobject.idle_add(
                    self.info_bar.set_stop_summary, stop_summary)
                self.last_update_time = time()
        try:
            update_time_str = time2str(self.stop_summary[0]["last_updated"])
        except (AttributeError, IndexError, KeyError, TypeError):
            update_time_str = None
        gobject.idle_add(
            self.info_bar.set_update_time,
            update_time_str, self.info_bar.DISCONNECTED_TEXT)
        gobject.idle_add(self.info_bar.prog_bar_stop)
Beispiel #10
0
    def reconnect( self ):
 
        try:
            client = cylc_pyro_client.client( 
                    self.cfg.suite,
                    self.cfg.pphrase,
                    self.cfg.owner,
                    self.cfg.host,
                    self.cfg.pyro_timeout,
                    self.cfg.port )
            self.god = client.get_proxy( 'state_summary' )
            self.remote = client.get_proxy( 'remote' )
        except:
            if self.stop_summary is None:
                self.stop_summary = dump.get_stop_state_summary(
                                                            self.cfg.suite,
                                                            self.cfg.owner,
                                                            self.cfg.host)
                if any(self.stop_summary):
                    self.info_bar.set_stop_summary(self.stop_summary)
            return False
        else:
            self.stop_summary = None
            self.family_nodes = self.remote.get_family_nodes()
            self.graphed_family_nodes = self.remote.get_graphed_family_nodes()
            self.families = self.remote.get_families()
            self.live_graph_movie, self.live_graph_dir = self.remote.do_live_graph_movie()
            if self.live_graph_movie:
                try:
                    mkdir_p( self.live_graph_dir )
                except Exception, x:
                    print >> sys.stderr, x
                    raise SuiteConfigError, 'ERROR, illegal dir? ' + self.live_graph_dir 

            self.status = "connected"
            self.info_bar.set_status( self.status )
            return True
Beispiel #11
0
    def reconnect(self):
        """Try to reconnect to the suite daemon."""
        if cylc.flags.debug:
            print >> sys.stderr, "  reconnection...",
        # Reset Pyro clients.
        self.suite_log_client.reset()
        self.state_summary_client.reset()
        self.suite_info_client.reset()
        self.suite_command_client.reset()
        try:
            self.daemon_version = self.suite_info_client.get_info(
                'get_cylc_version')
        except KeyError:
            self.daemon_version = "??? (pre 6.1.2?)"
            if cylc.flags.debug:
                print >> sys.stderr, "succeeded (old daemon)"
        except PortFileError as exc:
            # Failed to (re)connect.
            # Probably normal shutdown; get a stop summary if available.
            if not self.connect_fail_warned:
                self.connect_fail_warned = True
                gobject.idle_add(self.warn, str(exc))
            if self.stop_summary is None:
                self.stop_summary = get_stop_state_summary(
                    self.cfg.suite, self.cfg.owner, self.cfg.host)
                self._flag_new_update()
            if self.stop_summary is not None and any(self.stop_summary):
                gobject.idle_add(
                    self.info_bar.set_stop_summary, self.stop_summary)
            return
        except Exception as exc:
            if cylc.flags.debug:
                print >> sys.stderr, "failed: %s" % str(exc)
            if not self.connect_fail_warned:
                self.connect_fail_warned = True
                if isinstance(exc, Pyro.errors.ConnectionDeniedError):
                    gobject.idle_add(
                        self.warn,
                        "ERROR: %s\n\nIncorrect suite passphrase?" % exc)
                else:
                    gobject.idle_add(self.warn, str(exc))
            return

        self.app_window.set_title("%s - %s:%d" % (
            self.cfg.suite,
            self.suite_info_client.host,
            self.suite_info_client.port))
        if cylc.flags.debug:
            print >> sys.stderr, "succeeded"
        # Connected.
        self.connected = True
        self.set_status("connected")
        self.connect_fail_warned = False

        self.poll_schd.stop()
        if cylc.flags.debug:
            print >> sys.stderr, (
                "succeeded: daemon v %s" % self.daemon_version)
        if (self.daemon_version != CYLC_VERSION and
                not self.version_mismatch_warned):
            # (warn only once - reconnect() will be called multiple times
            # during initialisation of daemons at <= 6.4.0 (for which the state
            # summary object is not connected until all tasks are loaded).
            gobject.idle_add(
                self.warn,
                "Warning: cylc version mismatch!\n\n" +
                "Suite running with %r.\n" % self.daemon_version +
                "gcylc at %r.\n" % CYLC_VERSION)
            self.version_mismatch_warned = True
        self.stop_summary = None
        self.err_log_lines = []
        self.err_log_size = 0
        self._flag_new_update()
Beispiel #12
0
    def reconnect(self):
        """Try to reconnect to the suite daemon."""
        if cylc.flags.debug:
            print >> sys.stderr, "  reconnection...",
        # Reset comms clients.
        self.suite_log_client.reset()
        self.state_summary_client.reset()
        self.suite_info_client.reset()
        self.suite_command_client.reset()
        try:
            self.daemon_version = self.suite_info_client.get_info(
                'get_cylc_version')
        except ConnectionDeniedError as exc:
            if cylc.flags.debug:
                traceback.print_exc()
            if not self.connect_fail_warned:
                self.connect_fail_warned = True
                gobject.idle_add(
                    self.warn,
                    "ERROR: %s\n\nIncorrect suite passphrase?" % exc)
            return
        except ConnectionError as exc:
            # Failed to (re)connect
            # Suite not running, starting up or just stopped.
            if cylc.flags.debug:
                traceback.print_exc()
            # Use info bar to display stop summary if available.
            # Otherwise, just display the reconnect count down.
            if self.cfg.suite and self.stop_summary is None:
                stop_summary = get_stop_state_summary(
                    cat_state(self.cfg.suite, self.cfg.host, self.cfg.owner))
                self.last_update_time = time()
                if stop_summary != self.stop_summary:
                    self.stop_summary = stop_summary
                    self.status = SUITE_STATUS_STOPPED
                    gobject.idle_add(
                        self.info_bar.set_stop_summary, stop_summary)
            try:
                update_time_str = get_time_string_from_unix_time(
                    self.stop_summary[0]["last_updated"])
            except (AttributeError, IndexError, KeyError, TypeError):
                update_time_str = None
            gobject.idle_add(
                self.info_bar.set_update_time,
                update_time_str, self.info_bar.DISCONNECTED_TEXT)
            return
        except Exception as exc:
            if cylc.flags.debug:
                traceback.print_exc()
            if not self.connect_fail_warned:
                self.connect_fail_warned = True
                gobject.idle_add(self.warn, str(exc))
            return

        gobject.idle_add(
            self.app_window.set_title, "%s - %s:%s" % (
                self.cfg.suite, self.suite_info_client.host,
                self.suite_info_client.port))
        if cylc.flags.debug:
            print >> sys.stderr, "succeeded"
        # Connected.
        self.connected = True
        # This status will be very transient:
        self.set_status(SUITE_STATUS_CONNECTED)
        self.connect_fail_warned = False

        self.connect_schd.stop()
        if cylc.flags.debug:
            print >> sys.stderr, (
                "succeeded: daemon v %s" % self.daemon_version)
        if (self.daemon_version != CYLC_VERSION and
                not self.version_mismatch_warned):
            # (warn only once - reconnect() will be called multiple times
            # during initialisation of daemons at <= 6.4.0 (for which the state
            # summary object is not connected until all tasks are loaded).
            gobject.idle_add(
                self.warn,
                "Warning: cylc version mismatch!\n\n" +
                "Suite running with %r.\n" % self.daemon_version +
                "gcylc at %r.\n" % CYLC_VERSION)
            self.version_mismatch_warned = True
        self.stop_summary = None
        self.err_log_lines = []
        self.err_log_size = 0
        self.last_update_time = time()
Beispiel #13
0
    def reconnect(self):
        """Try to reconnect to the suite daemon."""
        if cylc.flags.debug:
            print >> sys.stderr, "  reconnection...",
        # Reset Pyro clients.
        self.suite_log_client.reset()
        self.state_summary_client.reset()
        self.suite_info_client.reset()
        self.suite_command_client.reset()
        try:
            self.daemon_version = self.suite_info_client.get_info(
                'get_cylc_version')
        except KeyError:
            self.daemon_version = "??? (pre 6.1.2?)"
            if cylc.flags.debug:
                print >> sys.stderr, "succeeded (old daemon)"
        except PortFileError as exc:
            if cylc.flags.debug:
                traceback.print_exc()
            # Failed to (re)connect.
            # Probably normal shutdown; get a stop summary if available.
            if not self.connect_fail_warned:
                self.connect_fail_warned = True
                gobject.idle_add(self.warn, str(exc))
            if self.cfg.suite and self.stop_summary is None:
                self.stop_summary = get_stop_state_summary(
                    cat_state(self.cfg.suite, self.cfg.host, self.cfg.owner))
                self.last_update_time = time()
            if self.stop_summary is not None and any(self.stop_summary):
                gobject.idle_add(self.info_bar.set_stop_summary,
                                 self.stop_summary)
            else:
                self.info_bar.set_update_time(None,
                                              self.info_bar.DISCONNECTED_TEXT)
            return
        except Pyro.errors.NamingError as exc:
            if cylc.flags.debug:
                traceback.print_exc()
            return
        except Exception as exc:
            if cylc.flags.debug:
                traceback.print_exc()
            if not self.connect_fail_warned:
                self.connect_fail_warned = True
                if isinstance(exc, Pyro.errors.ConnectionDeniedError):
                    gobject.idle_add(
                        self.warn,
                        "ERROR: %s\n\nIncorrect suite passphrase?" % exc)
                else:
                    gobject.idle_add(self.warn, str(exc))
            return

        gobject.idle_add(
            self.app_window.set_title,
            "%s - %s:%s" % (self.cfg.suite, self.suite_info_client.host,
                            self.suite_info_client.port))
        if cylc.flags.debug:
            print >> sys.stderr, "succeeded"
        # Connected.
        self.connected = True
        # This status will be very transient:
        self.set_status(SUITE_STATUS_CONNECTED)
        self.connect_fail_warned = False

        self.connect_schd.stop()
        if cylc.flags.debug:
            print >> sys.stderr, ("succeeded: daemon v %s" %
                                  self.daemon_version)
        if (self.daemon_version != CYLC_VERSION
                and not self.version_mismatch_warned):
            # (warn only once - reconnect() will be called multiple times
            # during initialisation of daemons at <= 6.4.0 (for which the state
            # summary object is not connected until all tasks are loaded).
            gobject.idle_add(
                self.warn, "Warning: cylc version mismatch!\n\n" +
                "Suite running with %r.\n" % self.daemon_version +
                "gcylc at %r.\n" % CYLC_VERSION)
            self.version_mismatch_warned = True
        self.stop_summary = None
        self.err_log_lines = []
        self.err_log_size = 0
        self.last_update_time = time()
Beispiel #14
0
    def reconnect(self):
        """Try to reconnect to the suite daemon."""
        if cylc.flags.debug:
            print >> sys.stderr, "  reconnection...",
        # Reset comms clients.
        self.suite_log_client.reset()
        self.state_summary_client.reset()
        self.suite_info_client.reset()
        self.suite_command_client.reset()
        try:
            self.daemon_version = self.suite_info_client.get_info(
                'get_cylc_version')
        except (ConnectionError) as exc:
            # Failed to (re)connect
            # Suite not running, starting up or just stopped.
            if cylc.flags.debug:
                traceback.print_exc()
            # Use info bar to display stop summary if available.
            # Otherwise, just display the reconnect count down.
            if self.cfg.suite and self.stop_summary is None:
                stop_summary = get_stop_state_summary(
                    cat_state(self.cfg.suite, self.cfg.host, self.cfg.owner))
                self.last_update_time = time()
                if stop_summary != self.stop_summary:
                    self.stop_summary = stop_summary
                    self.status = SUITE_STATUS_STOPPED
                    gobject.idle_add(
                        self.info_bar.set_stop_summary, stop_summary)
            try:
                update_time_str = get_time_string_from_unix_time(
                    self.stop_summary[0]["last_updated"])
            except (AttributeError, IndexError, KeyError, TypeError):
                update_time_str = None
            gobject.idle_add(
                self.info_bar.set_update_time,
                update_time_str, self.info_bar.DISCONNECTED_TEXT)
            return
        except ConnectionDeniedError as exc:
            if cylc.flags.debug:
                traceback.print_exc()
            if not self.connect_fail_warned:
                self.connect_fail_warned = True
                gobject.idle_add(
                    self.warn,
                    "ERROR: %s\n\nIncorrect suite passphrase?" % exc)
            return
        except Exception as exc:
            if cylc.flags.debug:
                traceback.print_exc()
            if not self.connect_fail_warned:
                self.connect_fail_warned = True
                gobject.idle_add(self.warn, str(exc))
            return

        gobject.idle_add(
            self.app_window.set_title, "%s - %s:%s" % (
                self.cfg.suite, self.suite_info_client.host,
                self.suite_info_client.port))
        if cylc.flags.debug:
            print >> sys.stderr, "succeeded"
        # Connected.
        self.connected = True
        # This status will be very transient:
        self.set_status(SUITE_STATUS_CONNECTED)
        self.connect_fail_warned = False

        self.connect_schd.stop()
        if cylc.flags.debug:
            print >> sys.stderr, (
                "succeeded: daemon v %s" % self.daemon_version)
        if (self.daemon_version != CYLC_VERSION and
                not self.version_mismatch_warned):
            # (warn only once - reconnect() will be called multiple times
            # during initialisation of daemons at <= 6.4.0 (for which the state
            # summary object is not connected until all tasks are loaded).
            gobject.idle_add(
                self.warn,
                "Warning: cylc version mismatch!\n\n" +
                "Suite running with %r.\n" % self.daemon_version +
                "gcylc at %r.\n" % CYLC_VERSION)
            self.version_mismatch_warned = True
        self.stop_summary = None
        self.err_log_lines = []
        self.err_log_size = 0
        self.last_update_time = time()