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:
Returns:

Tuple of counted nodes and clients

ffflash.inc.nodelist._nodelist_dump(ff, nodes, clients)[source]

Store the counted numbers in the api-file.

Sets the key state . nodes with the node number.

Leaves state . description untouched, 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.FFFlash instance
  • nodes – Number of online nodes
  • clients – Number of their clients
Returns:

True if api was modified else False

ffflash.inc.nodelist._nodelist_fetch(ff)[source]

Determines if --nodelist was 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.FFFlash instance
Returns:the unpickled nodelist or False/None on error
ffflash.inc.nodelist.handle_nodelist(ff)[source]

Entry function to receive a --nodelist and store determined results into both api and --rankfile (if specified).

Parameters:ff – running ffflash.main.FFFlash instance
Returns:True if api was modified else False

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.FFFlash instance
  • rankfile – validated path to the rankfile
  • ranks – content to store
Returns:

True on success, or False on error

ffflash.inc.rankfile._rankfile_load(ff)[source]

Load either existing rankfile from disk, or create empty stub if one does not exist yet. Path and extension (json) get validated.

Parameters:ff – running ffflash.main.FFFlash instance
Returns:Tuple of either (False, None) on error or:
  • validated path to the rankfile
  • rankfile content
ffflash.inc.rankfile._rankfile_score(ff, ranks, nodelist)[source]

Do some number crunching.

Parameters:
Returns:

ranks with new scores, sorted by score

ffflash.inc.rankfile.handle_rankfile(ff, nodelist)[source]

Entry function gather results from a retrieved --nodelist to store it into the --rankfile.

Parameters:ff – running ffflash.main.FFFlash instance
Returns:True if rankfile was modified else False