Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl-hive
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
7
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
ensembl-gh-mirror
ensembl-hive
Commits
e9d7e723
Commit
e9d7e723
authored
11 years ago
by
Matthieu Muffato
Browse files
Options
Downloads
Patches
Plain Diff
Added a mode to plot the amount of unused CPU cores each analysis
parent
9829697c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/generate_timeline.pl
+18
-12
18 additions, 12 deletions
scripts/generate_timeline.pl
with
18 additions
and
12 deletions
scripts/generate_timeline.pl
+
18
−
12
View file @
e9d7e723
...
...
@@ -74,6 +74,7 @@ sub main {
memory
=>
'
Memory asked (Gb)
',
cores
=>
'
Number of CPU cores
',
unused_memory
=>
'
Unused memory (Gb)
',
unused_cores
=>
'
Number of unused CPU cores
',
);
if
(
$mode
)
{
die
"
Unknown mode '
$mode
'. Allowed modes are:
"
.
join
("
,
",
keys
%allowed_modes
)
unless
exists
$allowed_modes
{
$mode
};
...
...
@@ -123,14 +124,14 @@ sub main {
warn
"
cpu_resources:
",
Dumper
\
%cpu_resources
if
$verbose
;
# Get the memory used by each worker
my
%used_
mem
=
();
if
(
$mode
eq
'
unused_memory
')
{
my
$sql_used_
mem
=
'
SELECT meadow_name, process_id, mem_megs FROM lsf_report
';
foreach
my
$db_entry
(
@
{
$dbh
->
selectall_arrayref
(
$sql_used_
mem
)})
{
my
(
$meadow_name
,
$process_id
,
$mem_megs
)
=
@$db_entry
;
$used_
mem
{
$meadow_name
.
"
_____
"
.
$process_id
}
=
$mem_megs
;
my
%used_
res
=
();
if
(
(
$mode
eq
'
unused_memory
')
or
(
$mode
eq
'
unused_cores
'))
{
my
$sql_used_
res
=
'
SELECT meadow_name, process_id, mem_megs
, cpu_sec/lifespan_sec
FROM lsf_report
';
foreach
my
$db_entry
(
@
{
$dbh
->
selectall_arrayref
(
$sql_used_
res
)})
{
my
(
$meadow_name
,
$process_id
,
$mem_megs
,
$cpu_usage
)
=
@$db_entry
;
$used_
res
{
$meadow_name
.
"
_____
"
.
$process_id
}
=
[
$mem_megs
,
$cpu_usage
]
;
}
warn
scalar
(
keys
%used_
mem
),
"
process info loaded from lsf_report
\n
"
if
$verbose
;
warn
scalar
(
keys
%used_
res
),
"
process info loaded from lsf_report
\n
"
if
$verbose
;
}
# Get the info about the analysis
...
...
@@ -164,11 +165,16 @@ sub main {
$events
{
$event_date
}{
$analysis_id
}
+=
$offset
*
(
$mem_resources
{
$resource_class_id
}
||
$default_memory
)
/
1024
.
;
}
elsif
(
$mode
eq
'
cores
')
{
$events
{
$event_date
}{
$analysis_id
}
+=
$offset
*
(
$cpu_resources
{
$resource_class_id
}
||
$default_cores
);
}
elsif
(
$mode
eq
'
unused_memory
')
{
my
$process_signature
=
$meadow_name
.
"
_____
"
.
$process_id
;
if
(
exists
$used_res
{
$process_signature
})
{
$events
{
$event_date
}{
$analysis_id
}
+=
$offset
*
((
$mem_resources
{
$resource_class_id
}
||
$default_memory
)
-
$used_res
{
$process_signature
}
->
[
0
])
/
1024
.
;
}
}
else
{
my
$process_signature
=
$meadow_name
.
"
_____
"
.
$process_id
;
if
(
exists
$used_
mem
{
$process_signature
})
{
my
$unused_
memory
=
(
$
mem
_resources
{
$resource_class_id
}
||
$default_
memory
)
-
$used_
mem
{
$process_signature
};
$events
{
$event_date
}{
$analysis_id
}
+=
$offset
*
$unused_
memory
/
1024
.
if
$unused_
memory
>
0
;
if
(
exists
$used_
res
{
$process_signature
})
{
my
$unused_
cores
=
(
$
cpu
_resources
{
$resource_class_id
}
||
$default_
cores
)
-
$used_
res
{
$process_signature
}
->
[
1
]
;
$events
{
$event_date
}{
$analysis_id
}
+=
$offset
*
$unused_
cores
if
$unused_
cores
>
0
;
}
}
}
...
...
@@ -328,7 +334,7 @@ __DATA__
generate_timeline.pl {-url <url> | [-reg_conf <reg_conf>] -reg_alias <reg_alias> [-reg_type <reg_type>] }
[-start_date <start_date>] [-end_date <end_date>]
[-top <float>]
[-mode [workers | memory | cores | unused_memory]]
[-mode [workers | memory | cores | unused_memory
| unused_cores
]]
[-n_core <int>] [-mem <int>]
=head1 DESCRIPTION
...
...
@@ -371,7 +377,7 @@ __DATA__
-end_date <date> : maximal end date of a worker (the format is ISO8601, e.g. '2012-01-25T13:46')
-top <float> : maximum number (> 1) or fraction (< 1) of analysis to report (default: 20)
-output <string> : output file: its extension must match one of the Gnuplot terminals. Otherwise, the CSV output is produced on stdout
-mode <string> : what should be displayed on the y-axis. Allowed values are 'workers' (default), 'memory', 'cores', 'unused_memory'
-mode <string> : what should be displayed on the y-axis. Allowed values are 'workers' (default), 'memory', 'cores', 'unused_memory'
, 'unused_cores'
-n_core <int> : the default number of cores allocated to a worker (default: 1)
-mem <int> : the default memory allocated to a worker (default: 100Mb)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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