FileCacheLoggingPlugin

File cache logging plugin.

class DIRAC.WorkloadManagementSystem.Client.PilotLoggingPlugins.FileCacheLoggingPlugin.FileCacheLoggingPlugin

Bases: PilotLoggingPlugin

File cache logging. Log records are appended to a file, one for each pilot. It is assumed that an agent will be installed together with this plugin, which will copy the files to a safe place and clear the cache.

__init__()

Sets the pilot log files location for a WebServer.

finaliseLogs(payload, logfile, vo)

Finalise a log file. Finalised logfile can be copied to a secure location.

Parameters:
  • payload (dict) – additional info, a plugin might want to use (i.e. the system return code of a pilot script)

  • logfile (str) – log filename (pilotUUID).

  • vo (str) – VO name of a pilot which sent the message.

Returns:

S_OK or S_ERROR

Return type:

dict

getLogs(logfile, vo)

Get the “instant” logs from Tornado log storage area. There are not finalised (incomplete) logs.

Returns:

Dirac S_OK containing the logs

Return type:

dict

getMeta()

Return any metadata related to this plugin. The “LogPath” is the minimum requirement for the dict to contain.

Returns:

Dirac S_OK containing the metadata or S_ERROR if the LogPath is not defined.

Return type:

dict

sendMessage(message, pilotUUID, vo)

File cache sendMessage method. Write the log message to a file line by line.

Parameters:
  • message (str) – text to log in json format

  • pilotUUID (str) – pilot id. Optimally it should be a pilot stamp if available, otherwise a generated UUID.

  • vo (str) – VO name of a pilot which sent the message.

Returns:

S_OK or S_ERROR

Return type:

dict