[Rest Server] Add launched time for job (#4301)

* Add launched time for job
* Add docs for duration
This commit is contained in:
Yifan Xiong 2020-03-20 01:11:11 +08:00 коммит произвёл GitHub
Родитель 5ec04d9700
Коммит b02f16b9cd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 27 добавлений и 6 удалений

Просмотреть файл

@ -1589,6 +1589,26 @@ components:
description: job name
jobStatus:
type: object
properties:
createdTime:
type: integer
description: job created time, in number of milliseconds since the Unix Epoch.
completedTime:
type: integer
description: job completed time, in number of milliseconds since the Unix Epoch.
appLaunchedTime:
type: integer
description: job launched time for last attempt, in number of milliseconds since the Unix Epoch.
appCompletedTime:
type: integer
description: >
job completed time for last attempt, in number of milliseconds since the Unix Epoch.
to get durations for last attempt:
wholeDuration = completedTime - createdTime;
runningDuration = appCompletedTime - appLaunchedTime;
waitingDuration = wholeDuration - runningDuration.
to get durations for all attempts:
runningDuration = sum(appCompletedTime - appLaunchedTime) for all attempts.
taskRoles:
type: object
description: TODO

Просмотреть файл

@ -219,12 +219,13 @@ const convertFrameworkDetail = async (framework) => {
if (!framework.status) {
framework.status = mockFrameworkStatus();
}
const attemptStatus = framework.status.attemptStatus;
// check fields which may be compressed
if (framework.status.attemptStatus.taskRoleStatuses == null) {
framework.status.attemptStatus.taskRoleStatuses = decompressField(framework.status.attemptStatus.taskRoleStatusesCompressed);
if (attemptStatus.taskRoleStatuses == null) {
attemptStatus.taskRoleStatuses = decompressField(attemptStatus.taskRoleStatusesCompressed);
}
const completionStatus = framework.status.attemptStatus.completionStatus;
const completionStatus = attemptStatus.completionStatus;
const diagnostics = completionStatus ? completionStatus.diagnostics : null;
const exitDiagnostics = generateExitDiagnostics(diagnostics);
const detail = {
@ -248,11 +249,11 @@ const convertFrameworkDetail = async (framework) => {
retryDelayTime: framework.status.retryPolicyStatus.retryDelaySec,
createdTime: new Date(framework.metadata.creationTimestamp).getTime(),
completedTime: new Date(framework.status.completionTime).getTime(),
appId: framework.status.attemptStatus.instanceUID,
appId: attemptStatus.instanceUID,
appProgress: completionStatus ? 1 : 0,
appTrackingUrl: '',
appLaunchedTime: new Date(framework.metadata.creationTimestamp).getTime(),
appCompletedTime: new Date(framework.status.completionTime).getTime(),
appLaunchedTime: new Date(attemptStatus.runTime || attemptStatus.completionTime).getTime(),
appCompletedTime: new Date(attemptStatus.completionTime).getTime(),
appExitCode: completionStatus ? completionStatus.code : null,
appExitSpec: completionStatus ? generateExitSpec(completionStatus.code) : generateExitSpec(null),
appExitDiagnostics: exitDiagnostics ? exitDiagnostics.diagnosticsSummary : null,