Management Models

The Cluster Health Management Model

class tgt_grease.management.Model.NodeMonitoring(ioc=<tgt_grease.core.InversionOfControl.GreaseContainer object>)

Bases: object

Monitors cluster nodes for unhealthy state

ioc

IoC Access

Type:GreaseContainer
centralScheduler

Central Scheduling Instance

Type:Scheduling
scheduler

Scheduling Model Instance

Type:Scheduler
deactivateServer(serverId)

deactivates server from pool

Parameters:serverId (str) – ObjectId to deactivate
Returns:If deactivation is successful
Return type:bool
getServers()

Returns the servers to be monitored this cycle

Returns:List of servers
Return type:list[dict]
monitor()

Monitoring process

Returns:If successful monitoring run occurred
Return type:bool
rescheduleDetectJobs(serverId)

Reschedules any detection jobs

Parameters:serverId (str) – Server ObjectId
Returns:rescheduling success
Return type:bool
rescheduleJobs(serverId)

Reschedules any detection jobs

Parameters:serverId (str) – Server ObjectId
Returns:rescheduling success
Return type:bool
rescheduleScheduleJobs(serverId)

Reschedules any detection jobs

Parameters:serverId (str) – Server ObjectId
Returns:rescheduling success
Return type:bool
scanComplete()

Enters a completed source so that this local server is alive next run

This method is so that the server’s ‘heart’ beats after each run. It will insert a completed SourceData document and increments the job counter in the JobServer Document

Returns:Writes a MongoDB Document
Return type:None
schedule_detection_orphans()
schedule_execution_orphans()
schedule_orphans()
schedule_scheduling_orphans()
serverAlive(serverId)

Checks to see if server is alive

This method checks if the serverID exists in the collection and determines if it’s execution number has changed recently. If it is a newly configured node it will be added to the monitoring collection

Parameters:serverId (str) – ObjectId of server
Returns:If server is alive
Return type:bool

The Bridge Management Model

class tgt_grease.management.Model.BridgeCommand(ioc=None)

Bases: object

Methods for Cluster Administration

imp

Import Tool Instance

Type:ImportTool
monitor

Node Monitoring Model Instance

Type:NodeMonitoring
action_activate(node=None)

activates server in cluster

Parameters:node (str) – MongoDB ObjectId to activate; defaults to local node
Returns:If activation is successful
Return type:bool
action_assign(prototype=None, role=None, node=None)

Assign prototypes/roles to a node either local or remote

Parameters:
  • prototype (str) – Prototype Job to assign
  • role (str) – Role to assign
  • node (str) – MongoDB ObjectId of node to assign to, if not provided will default to the local node
Returns:

If successful true else false

Return type:

bool

action_cull(node=None)

Culls a server from the active cluster

Parameters:node (str) – MongoDB ObjectId to cull; defaults to local node
action_info(node=None, jobs=None, prototypeJobs=None)

Gets Node Information

Parameters:
  • node (str) – MongoDB Object ID to get information about
  • jobs (bool) – If true then will retrieve jobs executed by this node
  • prototypeJobs (bool) – If true then prototype jobs will be printed as well

Note

provide a node argument via the CLI –node=4390qwr2fvdew458239

Note

provide a jobs argument via teh CLI –jobs

Note

provide a prototype jobs argument via teh CLI –pJobs

Returns:If Info was found
Return type:bool
action_register()

Ensures Registration of server

Returns:Registration status
Return type:bool
action_unassign(prototype=None, role=None, node=None)

Unassign prototypes to a node either local or remote

Parameters:
  • prototype (str) – Prototype Job to unassign
  • role (str) – Role to unassign
  • node (str) – MongoDB ObjectId of node to unassign to, if not provided will default to the local node
Returns:

If successful true else false

Return type:

bool

valid_server(node=None)

Validates node is in the MongoDB instance connected to

Parameters:node (str) – MongoDB Object ID to validate; defaults to local node
Returns:first element is boolean if valid second is objectId as string
Return type:tuple