pcvs.backend.report module

class pcvs.backend.report.Report[source]

Bases: object

Map a Report interface, to handle request from frontends.

add_session(path)[source]

Insert new session to be managed.

Parameters:

path (str) – the build path (root dir)

Return type:

None

classmethod dict_convert_list_to_cnt(l)[source]

Convert dict of arrays to a dict of array lengths.

Used to convert dict of per-status jobs to a summary of them.

Parameters:

l (dict) – the dict of arrays

Returns:

a summary of given dict

Return type:

dict

load_alive_sessions()[source]

Load currently active sessions as reference in PATH_SESSION.

A issue with this function, as invalid sessions are not managet yet.

Return type:

None

property session_ids: List[int]

Get the list of session ids managed by this instance.

Returns:

a list of session ids

Return type:

list of integers

session_infos()[source]

Get sesion metadata for each session currently loaded into the instance.

Returns:

the list of metadata (as dict)

Return type:

list

single_session_build_path(sid)[source]

Get build prefix of a given session.

Parameters:

sid (int) – session ID

Returns:

build path

Return type:

str

single_session_config(sid)[source]
Return type:

dict

single_session_get_view(sid, name, subset=None, summary=False)[source]

Get a specific view from a given session.

A view consists in a per-status split of jobs depending on the purpose of the stored view. PCVS currently provide automatically: * Per status * Per tags * Per labels

If subset is provided, only the nodes matching the key will be returned. If summary is True, a job count will be returned instead of actual job ids.

Parameters:
  • sid (int) – Session ID

  • name (str) – view name

  • subset (str, optional) – only a selection of the view, defaults to None

  • summary (bool, optional) – Should it be summarized, defaults to False

Returns:

the result dict

Return type:

dict

single_session_job_cnt(sid)[source]

Get per session number of job.

Parameters:

sid (int) – the session ID

Returns:

The number of jobs (total)

Return type:

int

single_session_labels(sid)[source]

Get per-session available labels.

Outputs a per-status dict.

Parameters:

sid (int) – Session ID

Returns:

dict of statuses

Return type:

dict

single_session_map_id(sid, jid)[source]

For a given session id, convert a job it into its relative clas:Test object.

Parameters:
  • sid (int) – Session ID

  • jid (int) – Job ID

Returns:

the Actual test object

Return type:

class:Test

single_session_status(sid, filter=None)[source]

Get per-session status infos

Parameters:
  • sid (int) – Session id to extract info from.

  • filter (str, optional) – optional status to filter in, defaults to None

Returns:

A dict of statuses (or a single list if the filter is used)

Return type:

dict or list

single_session_tags(sid)[source]

Get per-session available tags.

Outputs a per-status dict.

Parameters:

sid (int) – Session ID

Returns:

dict of statuses

Return type:

dict

pcvs.backend.report.build_static_pages(buildir)[source]

From a given build directory, generate static pages.

This can be used only for already run test-suites (no real-time support) and when Flask cannot/don’t want to be used.

Parameters:

buildir (str) – the build directory to load

Return type:

None

pcvs.backend.report.start_server(report)[source]

Initialize the Flask server, default to 5000.

A random port is picked if the default is already in use. :type report: Report :param report: The model to be used. :type report: class:Report :return: the application handler :rtype: class:Flask

pcvs.backend.report.upload_buildir_results(buildir)[source]

Upload a whole test-suite from disk to the server data model.

Parameters:

buildir (str) – the build directory

Return type:

None