Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mark-web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cylab
mark-web
Commits
d10dfe2a
Commit
d10dfe2a
authored
3 years ago
by
a.croix
Browse files
Options
Downloads
Patches
Plain Diff
Compute and display running time for a training. Fix issue
#34
parent
ba5b6796
No related branches found
No related tags found
No related merge requests found
Pipeline
#6782
passed
3 years ago
Stage: test
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/Jobs/WowaJob.php
+1
-0
1 addition, 0 deletions
app/Jobs/WowaJob.php
app/Wowa.php
+18
-0
18 additions, 0 deletions
app/Wowa.php
resources/views/wowa/show.blade.php
+7
-4
7 additions, 4 deletions
resources/views/wowa/show.blade.php
with
26 additions
and
4 deletions
app/Jobs/WowaJob.php
+
1
−
0
View file @
d10dfe2a
...
...
@@ -120,6 +120,7 @@ class WowaJob implements ShouldQueue
public
function
failed
()
{
$this
->
wowa
->
status
=
Wowa
::
STATE_FAILED
;
$this
->
wowa
->
end_time
=
time
();
$this
->
wowa
->
save
();
}
}
This diff is collapsed.
Click to expand it.
app/Wowa.php
+
18
−
0
View file @
d10dfe2a
...
...
@@ -137,4 +137,22 @@ class Wowa extends Model
$logger
->
pushHandler
(
new
StreamHandler
(
$this
->
getLogPathOnDisk
()));
return
$logger
;
}
public
function
runtime
()
{
if
(
$this
->
status
===
Wowa
::
STATE_RUNNING
)
{
return
$this
->
convertRuntimeToHumansFormat
(
time
()
-
$this
->
start_time
);
}
elseif
(
$this
->
status
===
Wowa
::
STATE_SUCCESS
||
$this
->
status
===
Wowa
::
STATE_FAILED
)
{
return
$this
->
convertRuntimeToHumansFormat
(
$this
->
end_time
-
$this
->
start_time
);
}
else
{
return
"Not running yet"
;
}
}
private
function
convertRuntimeToHumansFormat
(
int
$time
)
{
$dtF
=
new
\DateTime
(
'@0'
);
$dtT
=
new
\DateTime
(
"@
$time
"
);
return
$dtF
->
diff
(
$dtT
)
->
format
(
'%h hours, %i minutes and %s seconds'
);
}
}
This diff is collapsed.
Click to expand it.
resources/views/wowa/show.blade.php
+
7
−
4
View file @
d10dfe2a
...
...
@@ -5,18 +5,21 @@
<
div
class
=
"row justify-content-center"
>
<
div
class
=
"col-lg-8"
>
<
div
class
=
"card"
>
<
div
class
=
"card-header"
>
{
{
$wowa
->
created_at
}
}
</
div
>
<
div
class
=
"card-header"
>
{
!!
$wowa
->
statusBadge
()
!!
}
</
div
>
<
div
style
=
"position: relative"
class
=
"card-body"
>
<
div
class
=
"form-inline"
>
{
!!
$wowa
->
statusBadge
()
!!
}
</
div
>
<
div
id
=
"id"
>
<
p
>
<
i
class
=
"fas fa-hashtag"
></
i
>
<
b
>
Id
</
b
>
:
{{
$wowa
->
id
}}
</
p
>
</
div
>
<
div
id
=
"runtime"
>
<
p
>
<
i
class
=
"fas fa-stopwatch"
></
i
>
<
b
>
Runtime
</
b
>
:
{{
$wowa
->
runtime
()
}}
</
p
>
</
div
>
<
div
id
=
"user"
>
<
p
>
<
i
class
=
"fas fa-user"
></
i
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment