Nodelist¶
If a --nodelist is passed, it will be used to count online Nodes and
Clients from there.
It can either be a local file, or if this does not exist,
it is interpreted as URL, and fetched from there.
If successful, the numbers will be added to the APIfile:
{
"state": {
"nodes": 0,
"description": ""
}
}
Would be changed to this:
{
"state": {
"nodes": 23,
"description": "[23 Nodes, 42 Clients]"
}
}
-
ffflash.inc.nodelist._nodelist_count(ff, nodelist)[source]¶ Count online nodes and sum up their clients from a nodelist.
Parameters: - ff – running
ffflash.main.FFFlashinstance - nodelist – nodelist from
_nodelist_fetch(), should contain a list of dictionaries at the key nodes
Returns: Tuple of counted nodes and clients
- ff – running
-
ffflash.inc.nodelist._nodelist_dump(ff, nodes, clients)[source]¶ Store the counted numbers in the api-file.
Sets the key
state.nodeswith the node number.Leaves
state.descriptionuntouched, if any already present. If empty, or the pattern\[[\d]+ Nodes, [\d]+ Clients\]is matched, the numbers in the pattern will be replaced.Parameters: - ff – running
ffflash.main.FFFlashinstance - nodes – Number of online nodes
- clients – Number of their clients
Returns: Trueifapiwas modified elseFalse- ff – running
-
ffflash.inc.nodelist._nodelist_fetch(ff)[source]¶ Determines if
--nodelistwas a file or a url, and tries to fetch it. Validates nodelist to be json and to have the version, nodes and updated_at keys.Parameters: ff – running ffflash.main.FFFlashinstanceReturns: the unpickled nodelist or False/Noneon error
-
ffflash.inc.nodelist.handle_nodelist(ff)[source]¶ Entry function to receive a
--nodelistand store determined results into bothapiand--rankfile(if specified).Parameters: ff – running ffflash.main.FFFlashinstanceReturns: Trueifapiwas modified elseFalse
Rankfile¶
-
ffflash.inc.rankfile._rankfile_dump(ff, rankfile, ranks)[source]¶ Store ranks in
rankfile. Also sets a timestamp and writes the release string into the output.Parameters: - ff – running
ffflash.main.FFFlashinstance - rankfile – validated path to the
rankfile - ranks – content to store
Returns: Trueon success, orFalseon error- ff – running
-
ffflash.inc.rankfile._rankfile_load(ff)[source]¶ Load either existing
rankfilefrom disk, or create empty stub if one does not exist yet. Path and extension (json) get validated.Parameters: ff – running ffflash.main.FFFlashinstanceReturns: Tuple of either ( False,None) on error or:- validated path to the
rankfile rankfilecontent
- validated path to the
-
ffflash.inc.rankfile._rankfile_score(ff, ranks, nodelist)[source]¶ Do some number crunching.
Parameters: - ff – running
ffflash.main.FFFlashinstance - ranks – rankfile content from
_rankfile_load(), should contain a list of dictionaries at the key nodes - nodelist – nodelist from
ffflash.inc.nodelist._nodelist_fetch(), should contain a list of dictionaries at the key nodes
Returns: rankswith new scores, sorted by score- ff – running
-
ffflash.inc.rankfile.handle_rankfile(ff, nodelist)[source]¶ Entry function gather results from a retrieved
--nodelistto store it into the--rankfile.Parameters: ff – running ffflash.main.FFFlashinstanceReturns: Trueif rankfile was modified elseFalse