Django App hook

hook.apps

class hook.apps.HookConfig(app_name, app_module)

Bases: django.apps.config.AppConfig

name = 'hook'

hook.helper

hook.helper._checkIfAlreadyRunning()

Check if there is already a running worker pod :return: bool

hook.helper._getServiceAccountToken()

Loads service account auth token :return: token

hook.helper._spawnNewWorker()

Spawn a new Worker pod :return:

hook.helper.codeStatus(codes, header, messages, images=[])
hook.helper.convertOutput(out)
hook.helper.generate_label_table(results: Union[List, mongoengine.queryset.queryset.QuerySet], keys: List[str]) → numpy.array
Parameters
  • results – QuerySet with results

  • keys – list of all possible keys across all results

Returns

labels for plot in table form

hook.helper.get_dyn_keys(res: Union[List, mongoengine.queryset.queryset.QuerySet]) → Tuple[str, List]

Return all keys starting with dynamic_

Parameters

res – QuerySet containing all results to check

Returns

header string and array with labels

hook.helper.get_dyn_kv_pair(res: mongoDocuments.Result.Result)

Return String formatted with all key value pairs starting with dynamic_

Parameters

res

Returns

hook.helper.initialStatus()
hook.helper.pretty_request(request)
hook.helper.spawnWorker()

OpenShift API call to start a worker pod

hook.helper.speedupStatus(codes, header, messages, images)
hook.helper.vprint(message)

hook.views

hook.views.base(request)
hook.views.receiveHook(request)

Deal with incoming web hook