FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ceph-devstack/ceph_devstack/resources/ceph/utils.py at main · ceph/ceph-devstack · GitHub
ceph
ceph-devstack
Repository navigation
Code
Issues
4
(4)
Pull requests
8
(8)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ceph-devstack
/
ceph_devstack
/
resources
/
ceph
/
utils.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (31 loc) · 1.02 KB
Breadcrumbs
ceph-devstack
/
ceph_devstack
/
resources
/
ceph
/
utils.py
Copy path
File metadata and controls
38 lines (31 loc) · 1.02 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import
pathlib
import
re
from
datetime
import
datetime
from
typing
import
List
RUN_DIRNAME_PATTERN
=
re
.
compile
(
r"^(?P<username>^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}))-(?P<timestamp>\d{4}-\d{2}-\d{2}_\d{2}:\d{2}:\d{2})"
)
def
get_logtimestamp
(
dirname
:
str
)
->
datetime
:
match_
=
RUN_DIRNAME_PATTERN
.
search
(
dirname
)
assert
match_
return
datetime
.
strptime
(
match_
.
group
(
"timestamp"
),
"%Y-%m-%d_%H:%M:%S"
)
def
get_runs
(
directory
:
pathlib
.
Path
)
->
List
[
pathlib
.
Path
]:
return
sorted
(
(
dir_
for
dir_
in
directory
.
expanduser
().
absolute
().
iterdir
()
if
RUN_DIRNAME_PATTERN
.
search
(
dir_
.
name
)
),
key
=
lambda
dir_
:
dir_
.
stat
().
st_mtime
,
reverse
=
True
,
)
def
get_jobs
(
directory
:
pathlib
.
Path
)
->
List
[
pathlib
.
Path
]:
return
sorted
(
(
dir_
for
dir_
in
directory
.
expanduser
().
absolute
().
iterdir
()
if
str
(
dir_
.
name
).
isdigit
()
),
key
=
lambda
dir_
:
dir_
.
stat
().
st_mtime
,
reverse
=
True
,
)
Back
|
FazBrowse Home
|
New Git URL