Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
FACT Workflow Manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FACT
FACT Utils
FACT Workflow Manager
Commits
addf5331
Commit
addf5331
authored
1 year ago
by
Riccardo Boero
Browse files
Options
Downloads
Patches
Plain Diff
Added duration of execution
parent
306eacae
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Runner.jl
+3
-3
3 additions, 3 deletions
src/Runner.jl
src/Task.jl
+18
-2
18 additions, 2 deletions
src/Task.jl
with
21 additions
and
5 deletions
src/Runner.jl
+
3
−
3
View file @
addf5331
...
...
@@ -48,20 +48,20 @@ function run_file(workflowFilePath::String)
results_container
=
startResultsContainer
(
encoded_auth
)
# Start the data containers
startDataContainers
(
unique_services
,
encoded_auth
)
#
startDataContainers(unique_services, encoded_auth)
# Execute the workflow
need_to_update_results
=
manage_workflow
(
tasks
,
globals
[
"platform"
],
results_container
,
overwrite
)
# Stop the results container
if
need_to_update_results
#=
if need_to_update_results
saveResultsContainer(encoded_auth)
else
stopResultsContainer(encoded_auth)
end
# Stop the data containers
stopDataContainers
(
unique_services
,
encoded_auth
)
stopDataContainers(unique_services, encoded_auth)
=#
end
...
...
This diff is collapsed.
Click to expand it.
src/Task.jl
+
18
−
2
View file @
addf5331
...
...
@@ -32,7 +32,8 @@ This function will process the task parameters, execute the task, update the con
"""
function
run_task
(
task_name
::
String
,
task_info
::
Dict
,
dependencies_info
::
Dict
,
results_container
::
Dict
,
update_condition
::
Atomic
{
Bool
},
overwrite
::
Bool
)
println
(
"Starting task
$
task_name at
$
(Dates.format(now(), "
HH
:
MM
:
SS
"))"
)
start_time
=
now
()
# Capture the start time
println
(
"Starting task
$
task_name at
$
(Dates.format(start_time, "
HH
:
MM
:
SS
"))"
)
condition_met
=
false
...
...
@@ -50,7 +51,12 @@ function run_task(task_name::String, task_info::Dict, dependencies_info::Dict,
atomic_cas!
(
update_condition
,
false
,
true
)
# CAS: Compare-And-Swap
end
println
(
"Completed task
$
task_name at
$
(Dates.format(now(), "
HH
:
MM
:
SS
"))"
)
end_time
=
now
()
# Capture the end time
println
(
"Completed task
$
task_name at
$
(Dates.format(end_time, "
HH
:
MM
:
SS
"))"
)
# Calculate and print the duration
duration
=
print_duration_in_hms
(
end_time
-
start_time
)
# Duration as a Period type
println
(
"Duration of task
$
task_name:
$
duration"
)
end
...
...
@@ -232,4 +238,14 @@ function get_task_df(task_name::String, dependencies_info::Dict, results_contain
close_connection
(
results_connection
)
return
df
end
function
print_duration_in_hms
(
duration
::
Period
)
total_seconds
=
Dates
.
value
(
duration
)
# Get total seconds from the duration
hours
=
total_seconds
÷
3600
# Integer division to get hours
minutes
=
(
total_seconds
÷
60
)
%
60
# Remaining minutes
seconds
=
total_seconds
%
60
# Remaining seconds
# Format the string with leading zeros for minutes and seconds
return
"
$(hours)
h:
$
(lpad(minutes, 2, "
0
"))m:
$
(lpad(seconds, 2, "
0
"))s"
end
\ No newline at end of file
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