def clear_broadcast( self, point_strings=None, namespaces=None, cancel_settings=None): """Clear settings globally, or for listed namespaces and/or points. Return a tuple (modified_settings, bad_options), where: * modified_settings is similar to the return value of the "put" method, but for removed settings. * bad_options is a dict in the form: {"point_strings": ["20020202", ..."], ...} The dict is only populated if there are options not associated with previous broadcasts. The keys can be: * point_strings: a list of bad point strings. * namespaces: a list of bad namespaces. * cancel: a list of tuples. Each tuple contains the keys of a bad setting. """ self._check_access_priv_and_report(PRIV_FULL_CONTROL) point_strings = utf8_enforce( cherrypy.request.json.get("point_strings", point_strings)) namespaces = utf8_enforce( cherrypy.request.json.get("namespaces", namespaces)) cancel_settings = utf8_enforce( cherrypy.request.json.get("cancel_settings", cancel_settings)) return self.schd.task_events_mgr.broadcast_mgr.clear_broadcast( point_strings, namespaces, cancel_settings)
def clear_broadcast( self, point_strings=None, namespaces=None, cancel_settings=None): """Clear settings globally, or for listed namespaces and/or points. Return a tuple (modified_settings, bad_options), where: * modified_settings is similar to the return value of the "put" method, but for removed settings. * bad_options is a dict in the form: {"point_strings": ["20020202", ..."], ...} The dict is only populated if there are options not associated with previous broadcasts. The keys can be: * point_strings: a list of bad point strings. * namespaces: a list of bad namespaces. * cancel: a list of tuples. Each tuple contains the keys of a bad setting. """ self._check_access_priv_and_report(PRIV_FULL_CONTROL) point_strings = utf8_enforce( cherrypy.request.json.get("point_strings", point_strings)) namespaces = utf8_enforce( cherrypy.request.json.get("namespaces", namespaces)) cancel_settings = utf8_enforce( cherrypy.request.json.get("cancel_settings", cancel_settings)) return self.schd.task_events_mgr.broadcast_mgr.clear_broadcast( point_strings, namespaces, cancel_settings)
def put_broadcast( self, point_strings=None, namespaces=None, settings=None): """Add new broadcast settings (server side interface). Return a tuple (modified_settings, bad_options) where: modified_settings is list of modified settings in the form: [("20200202", "foo", {"command scripting": "true"}, ...] bad_options is as described in the docstring for self.clear(). """ self._check_access_priv_and_report(PRIV_FULL_CONTROL) point_strings = utf8_enforce( cherrypy.request.json.get("point_strings", point_strings)) namespaces = utf8_enforce( cherrypy.request.json.get("namespaces", namespaces)) settings = utf8_enforce( cherrypy.request.json.get("settings", settings)) return self.schd.task_events_mgr.broadcast_mgr.put_broadcast( point_strings, namespaces, settings)
def put_broadcast( self, point_strings=None, namespaces=None, settings=None): """Add new broadcast settings (server side interface). Return a tuple (modified_settings, bad_options) where: modified_settings is list of modified settings in the form: [("20200202", "foo", {"command scripting": "true"}, ...] bad_options is as described in the docstring for self.clear(). """ self._check_access_priv_and_report(PRIV_FULL_CONTROL) point_strings = utf8_enforce( cherrypy.request.json.get("point_strings", point_strings)) namespaces = utf8_enforce( cherrypy.request.json.get("namespaces", namespaces)) settings = utf8_enforce( cherrypy.request.json.get("settings", settings)) return self.schd.task_events_mgr.broadcast_mgr.put_broadcast( point_strings, namespaces, settings)
def put_messages(self, task_job=None, event_time=None, messages=None): """Put task messages in queue for processing later by the main loop. Arguments: task_job (str): Task job in the form "CYCLE/TASK_NAME/SUBMIT_NUM". event_time (str): Event time as string. messages (list): List in the form [[severity, message], ...]. """ self._check_access_priv_and_report(PRIV_FULL_CONTROL, log_info=False) task_job = utf8_enforce(cherrypy.request.json.get( "task_job", task_job)) event_time = utf8_enforce( cherrypy.request.json.get("event_time", event_time)) messages = utf8_enforce(cherrypy.request.json.get( "messages", messages)) for severity, message in messages: self.schd.message_queue.put( (task_job, event_time, severity, message)) return (True, 'Messages queued: %d' % len(messages))
def put_messages(self, task_job=None, event_time=None, messages=None): """Put task messages in queue for processing later by the main loop. Arguments: task_job (str): Task job in the form "CYCLE/TASK_NAME/SUBMIT_NUM". event_time (str): Event time as string. messages (list): List in the form [[severity, message], ...]. """ self._check_access_priv_and_report(PRIV_FULL_CONTROL, log_info=False) task_job = utf8_enforce( cherrypy.request.json.get("task_job", task_job)) event_time = utf8_enforce( cherrypy.request.json.get("event_time", event_time)) messages = utf8_enforce( cherrypy.request.json.get("messages", messages)) for severity, message in messages: self.schd.message_queue.put( (task_job, event_time, severity, message)) return (True, 'Messages queued: %d' % len(messages))
def test_utf8_encode_with_dictionary(self): value = unicode("d?") d = { "simple": "d", "complex": value } expected = { "simple": "d", "complex": "d?" } self.assertEqual(expected, utf8_enforce(d))
def get_suite_state_summary(self): """Return the global, task, and family summary data structures.""" return utf8_enforce(self._call_server( self._compat('get_suite_state_summary'), method=self.METHOD_GET))
def get_suite_state_summary(self): """Return the global, task, and family summary data structures.""" return utf8_enforce(self._call_server( self._compat('get_suite_state_summary'), method=self.METHOD_GET))
def test_utf8_encode_with_list(self): value = unicode("d?") d = ["d", value] expected = ["d", "d?"] self.assertEqual(expected, utf8_enforce(d))
def test_utf8_encode(self): value = unicode("d?") self.assertEqual("d?", utf8_enforce(value))
def test_utf8_encode_nothing_to_encode(self): self.assertEqual("d", utf8_enforce("d"))