-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Operations): preempted jobs [YTFRONT-4641]
- Loading branch information
1 parent
b1134a6
commit 0fc6580
Showing
6 changed files
with
98 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...es/ui/src/ui/pages/operations/OperationDetail/tabs/Jobs/OperationJobsTable/JobDetails.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, {FC} from 'react'; | ||
import {Tooltip} from '../../../../../../components/Tooltip/Tooltip'; | ||
import ypath from '../../../../../../common/thor/ypath'; | ||
import hammer from '../../../../../../common/hammer'; | ||
import {Flex, Icon} from '@gravity-ui/uikit'; | ||
import CircleQuestionIcon from '@gravity-ui/icons/svgs/circle-question.svg'; | ||
import map_ from 'lodash/map'; | ||
import MetaTable from '../../../../../../components/MetaTable/MetaTable'; | ||
import {RawJob} from '../../../../../../types/operations/job'; | ||
|
||
type Props = { | ||
statistics: RawJob['statistics']; | ||
type: string; | ||
}; | ||
|
||
const prepareStatistics = (statistics: RawJob['statistics']) => { | ||
return map_(ypath.getValue(statistics), (value, key: string) => { | ||
let result = hammer.format.Number(value); | ||
|
||
if (key.endsWith('_data_size') || key.endsWith('_data_weight')) { | ||
result = hammer.format.Bytes(value); | ||
} else if (key.endsWith('_time')) { | ||
result = hammer.format.TimeDuration(value, {format: 'milliseconds'}); | ||
} | ||
|
||
return { | ||
key: hammer.format.Readable(key), | ||
value: <div style={{textAlign: 'right'}}>{result}</div>, | ||
}; | ||
}); | ||
}; | ||
|
||
export const JobDetails: FC<Props> = ({statistics, type}) => { | ||
if (!statistics || type === 'vanilla') return null; | ||
|
||
const [rowCount, dataSize] = ypath.getValues(statistics, [ | ||
'/processed_input_row_count', | ||
'/processed_input_uncompressed_data_size', | ||
]); | ||
|
||
if (!rowCount && !dataSize) return null; | ||
|
||
return ( | ||
<Tooltip content={<MetaTable items={prepareStatistics(statistics)} />}> | ||
<Flex gap={2} alignItems="center"> | ||
<span> | ||
{hammer.format['Number'](rowCount)} ({hammer.format['Bytes'](dataSize)}) | ||
</span> | ||
<Icon data={CircleQuestionIcon} size={16} /> | ||
</Flex> | ||
</Tooltip> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+4.91 KB
(110%)
...tions/operations.base.screen.ts-snapshots/Operation---Jobs-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.