_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q236300 | Config.dump | train | def dump(self, dump_file_name=None):
"""Dump configuration to a file in a JSON format
:param dump_file_name: the file to dump configuration to
:type dump_file_name: str
:return: None
"""
config_dump = {}
for _, _, category, _, _ in list(self.types_creations.valu... | python | {
"resource": ""
} |
q236301 | Arbiter.push_broks_to_broker | train | def push_broks_to_broker(self): # pragma: no cover - not used!
"""Send all broks from arbiter internal list to broker
The arbiter get some broks and then pushes them to all the brokers.
:return: None
"""
someone_is_concerned = False
sent = False
for broker_link... | python | {
"resource": ""
} |
q236302 | Arbiter.push_external_commands_to_schedulers | train | def push_external_commands_to_schedulers(self): # pragma: no cover - not used!
"""Send external commands to schedulers
:return: None
"""
# Now get all external commands and push them to the schedulers
for external_command in self.external_commands:
self.external_com... | python | {
"resource": ""
} |
q236303 | Arbiter.get_broks_from_satellites | train | def get_broks_from_satellites(self): # pragma: no cover - not used!
"""Get broks from my all internal satellite links
The arbiter get the broks from ALL the known satellites
:return: None
"""
for satellites in [self.conf.brokers, self.conf.schedulers,
... | python | {
"resource": ""
} |
q236304 | Arbiter.get_initial_broks_from_satellites | train | def get_initial_broks_from_satellites(self):
"""Get initial broks from my internal satellite links
:return: None
"""
for satellites in [self.conf.brokers, self.conf.schedulers,
self.conf.pollers, self.conf.reactionners, self.conf.receivers]:
for sa... | python | {
"resource": ""
} |
q236305 | Arbiter.load_modules_configuration_objects | train | def load_modules_configuration_objects(self, raw_objects): # pragma: no cover,
# not yet with unit tests.
"""Load configuration objects from arbiter modules
If module implements get_objects arbiter will call it and add create
objects
:param raw_objects: raw objects we got from ... | python | {
"resource": ""
} |
q236306 | Arbiter.load_modules_alignak_configuration | train | def load_modules_alignak_configuration(self): # pragma: no cover, not yet with unit tests.
"""Load Alignak configuration from the arbiter modules
If module implements get_alignak_configuration, call this function
:param raw_objects: raw objects we got from reading config files
:type ra... | python | {
"resource": ""
} |
q236307 | Arbiter.request_stop | train | def request_stop(self, message='', exit_code=0):
"""Stop the Arbiter daemon
:return: None
"""
# Only a master arbiter can stop the daemons
if self.is_master:
# Stop the daemons
self.daemons_stop(timeout=self.conf.daemons_stop_timeout)
# Request t... | python | {
"resource": ""
} |
q236308 | Arbiter.start_daemon | train | def start_daemon(self, satellite):
"""Manage the list of detected missing daemons
If the daemon does not in exist `my_daemons`, then:
- prepare daemon start arguments (port, name and log file)
- start the daemon
- make sure it started correctly
:param satellite: ... | python | {
"resource": ""
} |
q236309 | Arbiter.daemons_start | train | def daemons_start(self, run_daemons=True):
"""Manage the list of the daemons in the configuration
Check if the daemon needs to be started by the Arbiter.
If so, starts the daemon if `run_daemons` is True
:param run_daemons: run the daemons or make a simple check
:type run_daem... | python | {
"resource": ""
} |
q236310 | Arbiter.daemons_stop | train | def daemons_stop(self, timeout=30, kill_children=False):
"""Stop the Alignak daemons
Iterate over the self-launched daemons and their children list to send a TERM
Wait for daemons to terminate and then send a KILL for those that are not yet stopped
As a default behavior, only the la... | python | {
"resource": ""
} |
q236311 | Arbiter.setup_new_conf | train | def setup_new_conf(self):
# pylint: disable=too-many-locals
""" Setup a new configuration received from a Master arbiter.
TODO: perharps we should not accept the configuration or raise an error if we do not
find our own configuration data in the data. Thus this should never happen...
... | python | {
"resource": ""
} |
q236312 | Arbiter.wait_for_master_death | train | def wait_for_master_death(self):
"""Wait for a master timeout and take the lead if necessary
:return: None
"""
logger.info("Waiting for master death")
timeout = 1.0
self.last_master_ping = time.time()
master_timeout = 300
for arbiter_link in self.conf.ar... | python | {
"resource": ""
} |
q236313 | Arbiter.manage_signal | train | def manage_signal(self, sig, frame):
"""Manage signals caught by the process
Specific behavior for the arbiter when it receives a sigkill or sigterm
:param sig: signal caught by the process
:type sig: str
:param frame: current stack frame
:type frame:
:return: No... | python | {
"resource": ""
} |
q236314 | Arbiter.configuration_dispatch | train | def configuration_dispatch(self, not_configured=None):
"""Monitored configuration preparation and dispatch
:return: None
"""
if not not_configured:
self.dispatcher = Dispatcher(self.conf, self.link_to_myself)
# I set my own dispatched configuration as the provide... | python | {
"resource": ""
} |
q236315 | Arbiter.do_before_loop | train | def do_before_loop(self):
"""Called before the main daemon loop.
:return: None
"""
logger.info("I am the arbiter: %s", self.link_to_myself.name)
# If I am a spare, I do not have anything to do here...
if not self.is_master:
logger.debug("Waiting for my maste... | python | {
"resource": ""
} |
q236316 | Arbiter.get_monitoring_problems | train | def get_monitoring_problems(self):
"""Get the schedulers satellites problems list
:return: problems dictionary
:rtype: dict
"""
res = self.get_id()
res['problems'] = {}
# Report our schedulers information, but only if a dispatcher exists
if getattr(self,... | python | {
"resource": ""
} |
q236317 | Arbiter.get_livesynthesis | train | def get_livesynthesis(self):
"""Get the schedulers satellites live synthesis
:return: compiled livesynthesis dictionary
:rtype: dict
"""
res = self.get_id()
res['livesynthesis'] = {
'_overall': {
'_freshness': int(time.time()),
... | python | {
"resource": ""
} |
q236318 | Service.overall_state_id | train | def overall_state_id(self):
"""Get the service overall state.
The service overall state identifier is the service status including:
- the monitored state
- the acknowledged state
- the downtime state
The overall state is (prioritized):
- a service is not monitor... | python | {
"resource": ""
} |
q236319 | Service.fill_predictive_missing_parameters | train | def fill_predictive_missing_parameters(self):
"""define state with initial_state
:return: None
"""
if self.initial_state == 'w':
self.state = u'WARNING'
elif self.initial_state == 'u':
self.state = u'UNKNOWN'
elif self.initial_state == 'c':
... | python | {
"resource": ""
} |
q236320 | Service.get_name | train | def get_name(self):
"""Accessor to service_description attribute or name if first not defined
:return: service name
:rtype: str
"""
if hasattr(self, 'service_description'):
return self.service_description
if hasattr(self, 'name'):
return self.name... | python | {
"resource": ""
} |
q236321 | Service.get_groupnames | train | def get_groupnames(self, sgs):
"""Get servicegroups list
:return: comma separated list of servicegroups
:rtype: str
"""
return ','.join([sgs[sg].get_name() for sg in self.servicegroups]) | python | {
"resource": ""
} |
q236322 | Service.duplicate | train | def duplicate(self, host):
# pylint: disable=too-many-locals
"""For a given host, look for all copy we must create for for_each property
:param host: alignak host object
:type host: alignak.objects.host.Host
:return: list
:rtype: list
"""
duplicates = []... | python | {
"resource": ""
} |
q236323 | Service.set_state_from_exit_status | train | def set_state_from_exit_status(self, status, notif_period, hosts, services):
"""Set the state in UP, WARNING, CRITICAL, UNKNOWN or UNREACHABLE
according to the status of a check result.
:param status: integer between 0 and 4
:type status: int
:return: None
"""
no... | python | {
"resource": ""
} |
q236324 | Service.is_state | train | def is_state(self, status):
# pylint: disable=too-many-return-statements
"""Return True if status match the current service status
:param status: status to compare ( "o", "c", "w", "u", "x"). Usually comes from config files
:type status: str
:return: True if status <=> self.stat... | python | {
"resource": ""
} |
q236325 | Service.last_time_non_ok_or_up | train | def last_time_non_ok_or_up(self):
"""Get the last time the service was in a non-OK state
:return: the nearest last time the service was not ok
:rtype: int
"""
non_ok_times = [x for x in [self.last_time_warning,
self.last_time_critical,
... | python | {
"resource": ""
} |
q236326 | Service.get_data_for_notifications | train | def get_data_for_notifications(self, contact, notif, host_ref):
"""Get data for a notification
:param contact: The contact to return
:type contact:
:param notif: the notification to return
:type notif:
:return: list containing the service, the host and the given paramete... | python | {
"resource": ""
} |
q236327 | Service.get_short_status | train | def get_short_status(self, hosts, services):
"""Get the short status of this host
:return: "O", "W", "C", "U', or "n/a" based on service state_id or business_rule state
:rtype: str
"""
mapping = {
0: "O",
1: "W",
2: "C",
3: "U",
... | python | {
"resource": ""
} |
q236328 | Services.add_template | train | def add_template(self, tpl):
"""
Adds and index a template into the `templates` container.
This implementation takes into account that a service has two naming
attribute: `host_name` and `service_description`.
:param tpl: The template to add
:type tpl:
:return: ... | python | {
"resource": ""
} |
q236329 | Services.find_srvs_by_hostname | train | def find_srvs_by_hostname(self, host_name):
"""Get all services from a host based on a host_name
:param host_name: the host name we want services
:type host_name: str
:return: list of services
:rtype: list[alignak.objects.service.Service]
"""
if hasattr(self, 'ho... | python | {
"resource": ""
} |
q236330 | Services.find_srv_by_name_and_hostname | train | def find_srv_by_name_and_hostname(self, host_name, sdescr):
"""Get a specific service based on a host_name and service_description
:param host_name: host name linked to needed service
:type host_name: str
:param sdescr: service name we need
:type sdescr: str
:return: th... | python | {
"resource": ""
} |
q236331 | Services.linkify_s_by_hst | train | def linkify_s_by_hst(self, hosts):
"""Link services with their parent host
:param hosts: Hosts to look for simple host
:type hosts: alignak.objects.host.Hosts
:return: None
"""
for serv in self:
# If we do not have a host_name, we set it as
# a te... | python | {
"resource": ""
} |
q236332 | Services.linkify_s_by_sg | train | def linkify_s_by_sg(self, servicegroups):
"""Link services with servicegroups
:param servicegroups: Servicegroups
:type servicegroups: alignak.objects.servicegroup.Servicegroups
:return: None
"""
for serv in self:
new_servicegroups = []
if hasattr... | python | {
"resource": ""
} |
q236333 | Services.clean | train | def clean(self):
"""Remove services without host object linked to
Note that this should not happen!
:return: None
"""
to_del = []
for serv in self:
if not serv.host:
to_del.append(serv.uuid)
for service_uuid in to_del:
del... | python | {
"resource": ""
} |
q236334 | Services.explode_services_from_hosts | train | def explode_services_from_hosts(self, hosts, service, hnames):
"""
Explodes a service based on a list of hosts.
:param hosts: The hosts container
:type hosts:
:param service: The base service to explode
:type service:
:param hnames: The host_name list to explode... | python | {
"resource": ""
} |
q236335 | Services._local_create_service | train | def _local_create_service(self, hosts, host_name, service):
"""Create a new service based on a host_name and service instance.
:param hosts: The hosts items instance.
:type hosts: alignak.objects.host.Hosts
:param host_name: The host_name to create a new service.
:type host_name... | python | {
"resource": ""
} |
q236336 | Services.explode_services_from_templates | train | def explode_services_from_templates(self, hosts, service_template):
"""
Explodes services from templates. All hosts holding the specified
templates are bound with the service.
:param hosts: The hosts container.
:type hosts: alignak.objects.host.Hosts
:param service_templ... | python | {
"resource": ""
} |
q236337 | Services.explode_services_duplicates | train | def explode_services_duplicates(self, hosts, service):
"""
Explodes services holding a `duplicate_foreach` clause.
:param hosts: The hosts container
:type hosts: alignak.objects.host.Hosts
:param service: The service to explode
:type service: alignak.objects.service.Serv... | python | {
"resource": ""
} |
q236338 | Services.register_service_into_servicegroups | train | def register_service_into_servicegroups(service, servicegroups):
"""
Registers a service into the service groups declared in its
`servicegroups` attribute.
:param service: The service to register
:type service:
:param servicegroups: The servicegroups container
:t... | python | {
"resource": ""
} |
q236339 | Services.register_service_dependencies | train | def register_service_dependencies(service, servicedependencies):
"""
Registers a service dependencies.
:param service: The service to register
:type service:
:param servicedependencies: The servicedependencies container
:type servicedependencies:
:return: None
... | python | {
"resource": ""
} |
q236340 | Services.explode | train | def explode(self, hosts, hostgroups, contactgroups, servicegroups, servicedependencies):
# pylint: disable=too-many-locals
"""
Explodes services, from host, hostgroups, contactgroups, servicegroups and dependencies.
:param hosts: The hosts container
:type hosts: [alignak.object.... | python | {
"resource": ""
} |
q236341 | Escalation.get_next_notif_time | train | def get_next_notif_time(self, t_wished, status, creation_time, interval, escal_period):
"""Get the next notification time for the escalation
Only legit for time based escalation
:param t_wished: time we would like to send a new notification (usually now)
:type t_wished:
:param s... | python | {
"resource": ""
} |
q236342 | Escalations.linkify_es_by_s | train | def linkify_es_by_s(self, services):
"""Add each escalation object into service.escalation attribute
:param services: service list, used to look for a specific service
:type services: alignak.objects.service.Services
:return: None
"""
for escalation in self:
... | python | {
"resource": ""
} |
q236343 | Escalations.linkify_es_by_h | train | def linkify_es_by_h(self, hosts):
"""Add each escalation object into host.escalation attribute
:param hosts: host list, used to look for a specific host
:type hosts: alignak.objects.host.Hosts
:return: None
"""
for escal in self:
# If no host, no hope of havi... | python | {
"resource": ""
} |
q236344 | Escalations.explode | train | def explode(self, hosts, hostgroups, contactgroups):
"""Loop over all escalation and explode hostsgroups in host
and contactgroups in contacts
Call Item.explode_host_groups_into_hosts and Item.explode_contact_groups_into_contacts
:param hosts: host list to explode
:type hosts: ... | python | {
"resource": ""
} |
q236345 | Hostgroup.get_hosts_by_explosion | train | def get_hosts_by_explosion(self, hostgroups):
# pylint: disable=access-member-before-definition
"""
Get hosts of this group
:param hostgroups: Hostgroup object
:type hostgroups: alignak.objects.hostgroup.Hostgroups
:return: list of hosts of this group
:rtype: lis... | python | {
"resource": ""
} |
q236346 | Hostgroups.add_member | train | def add_member(self, host_name, hostgroup_name):
"""Add a host string to a hostgroup member
if the host group do not exist, create it
:param host_name: host name
:type host_name: str
:param hostgroup_name:hostgroup name
:type hostgroup_name: str
:return: None
... | python | {
"resource": ""
} |
q236347 | Hostgroups.linkify | train | def linkify(self, hosts=None, realms=None, forced_realms_hostgroups=True):
"""Link hostgroups with hosts and realms
:param hosts: all Hosts
:type hosts: alignak.objects.host.Hosts
:param realms: all Realms
:type realms: alignak.objects.realm.Realms
:return: None
... | python | {
"resource": ""
} |
q236348 | Hostgroups.linkify_hostgroups_hosts | train | def linkify_hostgroups_hosts(self, hosts):
"""We just search for each hostgroup the id of the hosts
and replace the names by the found identifiers
:param hosts: object Hosts
:type hosts: alignak.objects.host.Hosts
:return: None
"""
for hostgroup in self:
... | python | {
"resource": ""
} |
q236349 | Hostgroups.explode | train | def explode(self):
"""
Fill members with hostgroup_members
:return: None
"""
# We do not want a same hostgroup to be exploded again and again
# so we tag it
for tmp_hg in list(self.items.values()):
tmp_hg.already_exploded = False
for hostgrou... | python | {
"resource": ""
} |
q236350 | HTTPDaemon.run | train | def run(self):
"""Wrapper to start the CherryPy server
This function throws a PortNotFree exception if any socket error is raised.
:return: None
"""
def _started_callback():
"""Callback function when Cherrypy Engine is started"""
cherrypy.log("CherryPy e... | python | {
"resource": ""
} |
q236351 | HTTPDaemon.stop | train | def stop(self): # pylint: disable=no-self-use
"""Wrapper to stop the CherryPy server
:return: None
"""
cherrypy.log("Stopping CherryPy engine (current state: %s)..." % cherrypy.engine.state)
try:
cherrypy.engine.exit()
except RuntimeWarning:
pass... | python | {
"resource": ""
} |
q236352 | BaseModule.create_queues | train | def create_queues(self, manager=None):
"""
Create the shared queues that will be used by alignak daemon
process and this module process.
But clear queues if they were already set before recreating new one.
Note:
If manager is None, then we are running the unit tests for ... | python | {
"resource": ""
} |
q236353 | BaseModule.clear_queues | train | def clear_queues(self, manager):
"""Release the resources associated to the queues of this instance
:param manager: Manager() object
:type manager: None | object
:return: None
"""
for queue in (self.to_q, self.from_q):
if queue is None:
contin... | python | {
"resource": ""
} |
q236354 | BaseModule.start_module | train | def start_module(self):
"""Wrapper for _main function.
Catch and raise any exception occurring in the main function
:return: None
"""
try:
self._main()
except Exception as exp:
logger.exception('%s', traceback.format_exc())
raise Excep... | python | {
"resource": ""
} |
q236355 | BaseModule.start | train | def start(self, http_daemon=None): # pylint: disable=unused-argument
"""Actually restart the process if the module is external
Try first to stop the process and create a new Process instance
with target start_module.
Finally start process.
:param http_daemon: Not used here but ... | python | {
"resource": ""
} |
q236356 | BaseModule.stop_process | train | def stop_process(self):
"""Request the module process to stop and release it
:return: None
"""
if not self.process:
return
logger.info("I'm stopping module %r (pid=%d)", self.name, self.process.pid)
self.kill()
# Clean inner process reference
... | python | {
"resource": ""
} |
q236357 | BaseModule.manage_brok | train | def manage_brok(self, brok):
"""Request the module to manage the given brok.
There are a lot of different possible broks to manage. The list is defined
in the Brok class.
An internal module may redefine this function or, easier, define only the function
for the brok it is intere... | python | {
"resource": ""
} |
q236358 | BaseModule.manage_signal | train | def manage_signal(self, sig, frame): # pylint: disable=unused-argument
"""Generic function to handle signals
Only called when the module process received SIGINT or SIGKILL.
Set interrupted attribute to True, self.process to None and returns
:param sig: signal sent
:type sig:
... | python | {
"resource": ""
} |
q236359 | BaseModule._main | train | def _main(self):
"""module "main" method. Only used by external modules.
:return: None
"""
self.set_proctitle(self.name)
self.set_signal_handler()
logger.info("process for module %s is now running (pid=%d)", self.name, os.getpid())
# Will block here!
tr... | python | {
"resource": ""
} |
q236360 | no_block_read | train | def no_block_read(output):
"""Try to read a file descriptor in a non blocking mode
If the fcntl is available (unix only) we try to read in a
asynchronous mode, so we won't block the PIPE at 64K buffer
(deadlock...)
:param output: file or socket to read from
:type output: file
:return: data... | python | {
"resource": ""
} |
q236361 | ActionBase.get_local_environnement | train | def get_local_environnement(self):
"""
Mix the environment and the environment variables into a new local
environment dictionary
Note: We cannot just update the global os.environ because this
would effect all other checks.
:return: local environment variables
:r... | python | {
"resource": ""
} |
q236362 | ActionBase.execute | train | def execute(self):
"""Start this action command in a subprocess.
:raise: ActionError
'toomanyopenfiles' if too many opened files on the system
'no_process_launched' if arguments parsing failed
'process_launch_failed': if the process launch failed
:return: re... | python | {
"resource": ""
} |
q236363 | ActionBase.copy_shell__ | train | def copy_shell__(self, new_i):
"""Create all attributes listed in 'ONLY_COPY_PROP' and return `self` with these attributes.
:param new_i: object to
:type new_i: object
:return: object with new properties added
:rtype: object
"""
for prop in ONLY_COPY_PROP:
... | python | {
"resource": ""
} |
q236364 | Contactgroup.get_contacts_by_explosion | train | def get_contacts_by_explosion(self, contactgroups):
# pylint: disable=access-member-before-definition
"""
Get contacts of this group
:param contactgroups: Contactgroups object, use to look for a specific one
:type contactgroups: alignak.objects.contactgroup.Contactgroups
... | python | {
"resource": ""
} |
q236365 | Contactgroups.add_member | train | def add_member(self, contact_name, contactgroup_name):
"""Add a contact string to a contact member
if the contact group do not exist, create it
:param contact_name: contact name
:type contact_name: str
:param contactgroup_name: contact group name
:type contactgroup_name:... | python | {
"resource": ""
} |
q236366 | Contactgroups.linkify_contactgroups_contacts | train | def linkify_contactgroups_contacts(self, contacts):
"""Link the contacts with contactgroups
:param contacts: realms object to link with
:type contacts: alignak.objects.contact.Contacts
:return: None
"""
for contactgroup in self:
mbrs = contactgroup.get_contac... | python | {
"resource": ""
} |
q236367 | Contactgroups.explode | train | def explode(self):
"""
Fill members with contactgroup_members
:return:None
"""
# We do not want a same hg to be explode again and again
# so we tag it
for tmp_cg in list(self.items.values()):
tmp_cg.already_exploded = False
for contactgroup i... | python | {
"resource": ""
} |
q236368 | SchedulingItem.add_flapping_change | train | def add_flapping_change(self, sample):
"""Add a flapping sample and keep cls.flap_history samples
:param sample: Sample to add
:type sample: bool
:return: None
"""
cls = self.__class__
# If this element is not in flapping check, or
# the flapping is glob... | python | {
"resource": ""
} |
q236369 | SchedulingItem.add_attempt | train | def add_attempt(self):
"""Add an attempt when a object is a non-ok state
:return: None
"""
self.attempt += 1
self.attempt = min(self.attempt, self.max_check_attempts) | python | {
"resource": ""
} |
q236370 | SchedulingItem.do_check_freshness | train | def do_check_freshness(self, hosts, services, timeperiods, macromodulations, checkmodulations,
checks, when):
# pylint: disable=too-many-nested-blocks, too-many-branches
"""Check freshness and schedule a check now if necessary.
This function is called by the scheduler... | python | {
"resource": ""
} |
q236371 | SchedulingItem.update_business_impact_value | train | def update_business_impact_value(self, hosts, services, timeperiods, bi_modulations):
"""We update our 'business_impact' value with the max of
the impacts business_impact if we got impacts. And save our 'configuration'
business_impact if we do not have do it before
If we do not have impa... | python | {
"resource": ""
} |
q236372 | SchedulingItem.no_more_a_problem | train | def no_more_a_problem(self, hosts, services, timeperiods, bi_modulations):
"""Remove this objects as an impact for other schedulingitem.
:param hosts: hosts objects, used to get impacts
:type hosts: alignak.objects.host.Hosts
:param services: services objects, used to get impacts
... | python | {
"resource": ""
} |
q236373 | SchedulingItem.register_a_problem | train | def register_a_problem(self, prob, hosts, services, timeperiods, bi_modulations):
# pylint: disable=too-many-locals
"""Call recursively by potentials impacts so they
update their source_problems list. But do not
go below if the problem is not a real one for me
like If I've got mu... | python | {
"resource": ""
} |
q236374 | SchedulingItem.unregister_a_problem | train | def unregister_a_problem(self, prob):
"""Remove the problem from our problems list
and check if we are still 'impacted'
:param prob: problem to remove
:type prob: alignak.objects.schedulingitem.SchedulingItem
:return: None
"""
self.source_problems.remove(prob.uui... | python | {
"resource": ""
} |
q236375 | SchedulingItem.is_enable_action_dependent | train | def is_enable_action_dependent(self, hosts, services):
"""
Check if dependencies states match dependencies statuses
This basically means that a dependency is in a bad state and
it can explain this object state.
:param hosts: hosts objects, used to get object in act_depend_of
... | python | {
"resource": ""
} |
q236376 | SchedulingItem.check_and_set_unreachability | train | def check_and_set_unreachability(self, hosts, services):
"""
Check if all dependencies are down, if yes set this object
as unreachable.
todo: this function do not care about execution_failure_criteria!
:param hosts: hosts objects, used to get object in act_depend_of
:ty... | python | {
"resource": ""
} |
q236377 | SchedulingItem.compensate_system_time_change | train | def compensate_system_time_change(self, difference): # pragma: no cover,
# not with unit tests
"""If a system time change occurs we have to update
properties time related to reflect change
:param difference: difference between new time and old time
:type difference:
:re... | python | {
"resource": ""
} |
q236378 | SchedulingItem.remove_in_progress_check | train | def remove_in_progress_check(self, check):
"""Remove check from check in progress
:param check: Check to remove
:type check: alignak.objects.check.Check
:return: None
"""
# The check is consumed, update the in_checking properties
if check in self.checks_in_progre... | python | {
"resource": ""
} |
q236379 | SchedulingItem.remove_in_progress_notification | train | def remove_in_progress_notification(self, notification):
"""
Remove a notification and mark them as zombie
:param notification: the notification to remove
:type notification: alignak.notification.Notification
:return: None
"""
if notification.uuid in self.notific... | python | {
"resource": ""
} |
q236380 | SchedulingItem.remove_in_progress_notifications | train | def remove_in_progress_notifications(self, master=True):
"""Remove all notifications from notifications_in_progress
Preserves some specific notifications (downtime, ...)
:param master: remove master notifications only if True (default value)
:type master: bool
:param force: for... | python | {
"resource": ""
} |
q236381 | SchedulingItem.check_for_flexible_downtime | train | def check_for_flexible_downtime(self, timeperiods, hosts, services):
"""Enter in a downtime if necessary and raise start notification
When a non Ok state occurs we try to raise a flexible downtime.
:param timeperiods: Timeperiods objects, used for downtime period
:type timeperiods: alig... | python | {
"resource": ""
} |
q236382 | SchedulingItem.update_hard_unknown_phase_state | train | def update_hard_unknown_phase_state(self):
"""Update in_hard_unknown_reach_phase attribute and
was_in_hard_unknown_reach_phase
UNKNOWN during a HARD state are not so important, and they should
not raise notif about it
:return: None
"""
self.was_in_hard_unknown_r... | python | {
"resource": ""
} |
q236383 | SchedulingItem.update_notification_command | train | def update_notification_command(self, notif, contact, macromodulations, timeperiods,
host_ref=None):
"""Update the notification command by resolving Macros
And because we are just launching the notification, we can say
that this contact has been notified
... | python | {
"resource": ""
} |
q236384 | SchedulingItem.is_escalable | train | def is_escalable(self, notification, escalations, timeperiods):
"""Check if a notification can be escalated.
Basically call is_eligible for each escalation
:param notification: notification we would like to escalate
:type notification: alignak.objects.notification.Notification
:... | python | {
"resource": ""
} |
q236385 | SchedulingItem.get_next_notification_time | train | def get_next_notification_time(self, notif, escalations, timeperiods):
# pylint: disable=too-many-locals
"""Get the next notification time for a notification
Take the standard notification_interval or ask for our escalation
if one of them need a smaller value to escalade
:param ... | python | {
"resource": ""
} |
q236386 | SchedulingItem.get_business_rule_output | train | def get_business_rule_output(self, hosts, services, macromodulations, timeperiods):
# pylint: disable=too-many-locals, too-many-branches
"""
Returns a status string for business rules based items formatted
using business_rule_output_template attribute as template.
The template m... | python | {
"resource": ""
} |
q236387 | SchedulingItem.business_rule_notification_is_blocked | train | def business_rule_notification_is_blocked(self, hosts, services):
# pylint: disable=too-many-locals
"""Process business rule notifications behaviour. If all problems have
been acknowledged, no notifications should be sent if state is not OK.
By default, downtimes are ignored, unless expl... | python | {
"resource": ""
} |
q236388 | SchedulingItem.fill_data_brok_from | train | def fill_data_brok_from(self, data, brok_type):
"""Fill data brok dependent on the brok_type
:param data: data to fill
:type data: dict
:param brok_type: brok type
:type: str
:return: None
"""
super(SchedulingItem, self).fill_data_brok_from(data, brok_typ... | python | {
"resource": ""
} |
q236389 | SchedulingItem.acknowledge_problem | train | def acknowledge_problem(self, notification_period, hosts, services, sticky, notify, author,
comment, end_time=0):
# pylint: disable=too-many-arguments
"""
Add an acknowledge
:param sticky: acknowledge will be always present is host return in UP state
... | python | {
"resource": ""
} |
q236390 | SchedulingItem.check_for_expire_acknowledge | train | def check_for_expire_acknowledge(self):
"""
If have acknowledge and is expired, delete it
:return: None
"""
if (self.acknowledgement and
self.acknowledgement.end_time != 0 and
self.acknowledgement.end_time < time.time()):
self.unacknow... | python | {
"resource": ""
} |
q236391 | SchedulingItem.unacknowledge_problem | train | def unacknowledge_problem(self):
"""
Remove the acknowledge, reset the flag. The comment is deleted
:return: None
"""
if self.problem_has_been_acknowledged:
logger.debug("[item::%s] deleting acknowledge of %s",
self.get_name(),
... | python | {
"resource": ""
} |
q236392 | SchedulingItem.unacknowledge_problem_if_not_sticky | train | def unacknowledge_problem_if_not_sticky(self):
"""
Remove the acknowledge if it is not sticky
:return: None
"""
if hasattr(self, 'acknowledgement') and self.acknowledgement is not None:
if not self.acknowledgement.sticky:
self.unacknowledge_problem() | python | {
"resource": ""
} |
q236393 | SchedulingItem.set_impact_state | train | def set_impact_state(self):
"""We just go an impact, so we go unreachable
But only if we enable this state change in the conf
:return: None
"""
cls = self.__class__
if cls.enable_problem_impacts_states_change:
logger.debug("%s is impacted and goes UNREACHABLE... | python | {
"resource": ""
} |
q236394 | SchedulingItem.unset_impact_state | train | def unset_impact_state(self):
"""Unset impact, only if impact state change is set in configuration
:return: None
"""
cls = self.__class__
if cls.enable_problem_impacts_states_change and not self.state_changed_since_impact:
self.state = self.state_before_impact
... | python | {
"resource": ""
} |
q236395 | SchedulingItems.find_by_filter | train | def find_by_filter(self, filters, all_items):
"""
Find items by filters
:param filters: list of filters
:type filters: list
:param all_items: monitoring items
:type: dict
:return: list of items
:rtype: list
"""
items = []
for i in ... | python | {
"resource": ""
} |
q236396 | SchedulingItems.add_act_dependency | train | def add_act_dependency(self, son_id, parent_id, notif_failure_criteria, dep_period,
inherits_parents):
"""
Add a logical dependency for actions between two hosts or services.
:param son_id: uuid of son host
:type son_id: str
:param parent_id: uuid of p... | python | {
"resource": ""
} |
q236397 | SchedulingItems.del_act_dependency | train | def del_act_dependency(self, son_id, parent_id): # pragma: no cover, not yet tested
"""Remove act_dependency between two hosts or services.
TODO: do we really intend to remove dynamically ?
:param son_id: uuid of son host/service
:type son_id: str
:param parent_id: uuid of par... | python | {
"resource": ""
} |
q236398 | SchedulingItems.add_chk_dependency | train | def add_chk_dependency(self, son_id, parent_id, notif_failure_criteria, dep_period,
inherits_parents):
"""
Add a logical dependency for checks between two hosts or services.
:param son_id: uuid of son host/service
:type son_id: str
:param parent_id: uu... | python | {
"resource": ""
} |
q236399 | SchedulingItems.create_business_rules | train | def create_business_rules(self, hosts, services, hostgroups, servicegroups,
macromodulations, timeperiods):
"""
Loop on hosts or services and call SchedulingItem.create_business_rules
:param hosts: hosts to link to
:type hosts: alignak.objects.host.Hosts
... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.