Developper tasks management¶
How the task management works ?
Before see tasks¶
You must know that task is a generic system can run modules. So each module (network inventory, network discovery...) is independant, but the tasks is used to schedule their execution.
[Task management run] => execute the module => [module network inventory]
Elements of a task¶
A task if defined by:
General config¶
This config define:
- Communication mode: push (server force agent to contact himm when task start) or pull (wait agent contact himself the server)
- Periodicity: used to run automatically the task all xx times
Jobs¶
In a task, you can have many jobs. Most cases we use only one task, but this is an example of the works of 2 jobs:
- job 1: wake up computer at 1h a.m. (with module WakeOnLan)
- job 2: deploy a software at 2h a.m. (with module Deploy)
These jobs are defined by:
- a module: these modules is independant of task
- definitions: it's items / definition of what to do (in relation with the module). This list is get in the module defined. For example, a network inventory will have ip range, network equipment and printers. You can have many definitions
- Actions: it is used to define the FusionInventory agent used to run in relation with the definitions defined.
Starting a task, what is the process¶
There are the steps:
- Start run task (forced or scheduled)
- Task run the function prepareRun of the module of the job.
- This function is used to prepare the job for each agent.
- If task in push mode, it can made task in error if agent not available, else say to task the agent is ready to start
- Create lines in table glpi_plugin_fusioninventory_taskjobstatus with each action for each agent (when agent will contact server, it will see in this table what it must do).
- in return of prepareRun function, task is in error or is ok. if communication mode is in push, task start remotely the agents
- Task is now ready and finished to start
Running the task¶
When task is finished to start, this is the steps:
- Agent contact the server
- server see if in table glpi_plugin_fusioninventory_taskjobstatus tasks is waiting to this agent
- if yes, server run module function run of the module defined in table taskjobstatus, this function will create data to send to agent
- data are sent to agent
Schema¶
