def process_status(self, arguments, arguments_map, output_method, console_context): """ Processes the status command, with the given arguments and output method. @type arguments: List @param arguments: The arguments for the processing. @type arguments_map: Dictionary @param arguments_map: The map of arguments for the processing. @type output_method: Method @param output_method: The output method to be used in the processing. @type console_context: ConsoleContext @param console_context: The console context for the processing. """ # retrieves the plugin manager and uses it to retrieve the # various attributes to be displayed to the user plugin_manager = self.plugin.manager plugin_manager_uid = plugin_manager.uid plugin_manager_version = plugin_manager.get_version() plugin_manager_release = plugin_manager.get_release() plugin_manager_build = plugin_manager.get_build() plugin_manager_release_date_time = plugin_manager.get_release_date_time() plugin_manager_layout_mode = plugin_manager.get_layout_mode() plugin_manager_run_mode = plugin_manager.get_run_mode() plugin_manager_environment = plugin_manager.get_environment() # retrieves the current time and the plugin manager (start) # timestamp and calculates the uptime as the difference between # both values (time delta) current_time = time.time() plugin_manager_timestamp = plugin_manager.get_timestamp() uptime = current_time - plugin_manager_timestamp # creates the uptime string uptime_string = colony.format_seconds_smart(uptime, "basic", ("day", "hour", "minute", "second")) # retrieves the plugin manager instances plugin_manager_instances = plugin_manager.plugin_instances # retrieves the plugin strings from the plugin manager instances plugins_string, replicas_string, instances_string = self.get_plugin_strings(plugin_manager_instances) # prints the status values output_method("uid: " + plugin_manager_uid) output_method("version: " + plugin_manager_version) output_method("release: " + plugin_manager_release) output_method("build: " + plugin_manager_build) output_method("release date: " + plugin_manager_release_date_time) output_method("environment: " + plugin_manager_environment) output_method("layout mode: " + plugin_manager_layout_mode) output_method("run mode: " + plugin_manager_run_mode) output_method("uptime: " + uptime_string) output_method("plugins: " + plugins_string) output_method("replicas: " + replicas_string) output_method("instances: " + instances_string)
def _get_framework_information(self): """ Retrieves an information map containing information about the framework. @rtype: Dictionary @return: An information map containing information about the framework. """ # retrieves the plugin manager plugin_manager = self.plugin.manager # retrieves the plugin amnager uid plugin_manager_uid = plugin_manager.uid # retrieves the plugin manager version plugin_manager_version = plugin_manager.get_version() # retrieves the plugin manager release plugin_manager_release = plugin_manager.get_release() # retrieves the plugin manager build plugin_manager_build = plugin_manager.get_build() # retrieves the plugin manager release date time plugin_manager_release_date_time = plugin_manager.get_release_date_time() # retrieves the plugin manager layout mode plugin_manager_layout_mode = plugin_manager.get_layout_mode() # retrieves the plugin manager run mode plugin_manager_run_mode = plugin_manager.get_run_mode() # retrieves the plugin manager environment plugin_manager_environment = plugin_manager.get_environment() # retrieves the current time current_time = time.time() # retrieves the plugin manager timestamp and uses it for the # calculus of the uptime for the current system plugin_manager_timestamp = plugin_manager.get_timestamp() uptime = current_time - plugin_manager_timestamp # creates the uptime string uptime_string = colony.format_seconds_smart(uptime, "basic", ("day", "hour", "minute", "second")) # retrieves the plugin manager instances plugin_manager_instances = plugin_manager.plugin_instances # retrieves the plugin strings from the plugin manager instances plugins_string, replicas_string, instances_string = self._get_plugin_strings(plugin_manager_instances) # creates the framework information map framework_information = colony.OrderedMap() # sets the framework information (map) values framework_information["uid"] = plugin_manager_uid framework_information["version"] = plugin_manager_version framework_information["release"] = plugin_manager_release framework_information["build"] = plugin_manager_build framework_information["release date"] = plugin_manager_release_date_time framework_information["environment"] = plugin_manager_environment framework_information["layout mode"] = plugin_manager_layout_mode framework_information["run mode"] = plugin_manager_run_mode framework_information["uptime"] = uptime_string framework_information["plugins"] = plugins_string framework_information["replicas"] = replicas_string framework_information["instances"] = instances_string # returns the framework information (map) return framework_information