![]() |
FOSSology Advancing open source analysis and development |
The fossology scheduler daemon processes the fossology job input queue and agents.
The scheduler keeps track of three things: jobs, agents, and running tasks. It records its status in the scheduler_status table. The scheduler assigns each job to 1 or more agents, and ensures that there are not too many jobs running at the same time. The number, hosts, and agent parameters are all specified in the schedulers config file (typically /usr/local/etc/fossology/Scheduler.conf).
The logic works as follows:
For a detailed developer oriented discussion of fossology-scheduler see scheduler.
The scheduler must run as user 'fossy'. If it is started as root, then it will immediately change itself to run as user 'fossy' in group 'fossy'.
/usr/local/fossology/agents/fossology-scheduler [options] [setup.conf] < 'type command'Common usage:
/usr/local/fossology/agents/fossology-scheduler -d -L /tmp/foss-scheduler.log
This is the fossology job scheduler. When an upload is analyzed by fossology it is the scheduler that takes the upload and schedules a number of agents to operate on that upload. The most basic agents do things like unpack the archive and store it in the repository and the data-base. Other agents perform tasks like license analysis, and meta-data analysis.
The scheduler uses a configuration file to schedule the agents. This allows for flexible scheduling depending on the machines resources available. Usually the agent configuration file is created when fossology is installed. If setup.conf is not specified then /usr/local/share/fossology/agents/foss-scheduler.conf is used.
Advanced users or programmers adding agents to the system may need to regenerate this file or edit it directly. A custom file can also be used.
The setup.conf file defines each kind of known agent and how to run it. The list of jobs to run comes from the database's jobqueue table. Alternately (for debugging), -I can be used to specify the jobs to run using stdin.
The scheduler uses a configuration file to specify the number of processes per host and each agent. A configuration file creator script, mkschedconf, is available to aid in the creation of this file. For example, here is a snipped of a config file where all the agents run on localhost:
%Host localhost 2 1
agent=wget host=localhost | /usr/local/fossology/agents/wget_agent
agent=unpack host=localhost | /usr/local/fossology/agents/engine-shell unpack '/usr/local/fossology/agents/ununpack -d /home/repository//ununpack/%{U} -qRCQx'
agent=filter_license host=localhost | /usr/local/fossology/agents/Filter_License
agent=filter_license host=localhost | /usr/local/fossology/agents/Filter_License
agent=license host=localhost | /usr/local/fossology/agents/bsam-engine -L 20 -A 0 -B 60 -G 10 -M 2 -E -T license -O n -- - /usr/local/share/fossology/agents/License.bsam
agent=mimetype host=localhost | /usr/local/fossology/agents/mimetype
agent=mimetype host=localhost | /usr/local/fossology/agents/mimetype
agent=specagent host=localhost | /usr/local/fossology/agents/specagent
agent=filter_clean host=localhost | /usr/local/fossology/agents/filter_clean -s
agent=pkgmetagetta host=localhost | /usr/local/fossology/agents/pkgmetagetta
agent=pkgmetagetta host=localhost | /usr/local/fossology/agents/pkgmetagetta
Here is a snippet where agents will be spawned both on the localhost and across multiple machines via ssh:
agent=pkgmetagetta host=buckbeak.ostt | /usr/bin/ssh buckbeak.ostt "/usr/local/lib/fossology/agents/pkgmetagetta"
agent=selftest host=buckbeak.ostt | /usr/bin/ssh buckbeak.ostt "/usr/local/lib/fossology/agents/selftest -s"
agent=adj2nest host=buckbeak.ostt | /usr/bin/ssh buckbeak.ostt "/usr/local/lib/fossology/agents/adj2nest"
agent=fo_notify host=sirius.ostt | /usr/local/lib/fossology/agents/engine-shell fo_notify '/usr/local/bin/fo_notify %{*}'
agent=fosscp_agent host=sirius.ostt | /usr/bin/ssh buckbeak.ostt "/usr/local/lib/fossology/agents/engine-shell fosscp_agent '/usr/local/bin/cp2foss %{*}'"
agent=fossjobstat host=localhost | /usr/local/lib/fossology/agents/engine-shell fossjobstat '/usr/local/bin/fossjobstat %{*}'
The format of the configuration file is as follows:
Usage: ./fossology-scheduler [options] [setup.conf] < 'type command'
The standard way to start and stop fossology-scheduler is:
sudo /etc/init.d/fossology start sudo /etc/init.d/fossology stop
To validate the scheduler configuration file and verify that all agents will run:
sudo /usr/lib/fossology/foss-scheduler -t -L stdout