Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DCT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
graintracking
DCT
Commits
98756d05
Commit
98756d05
authored
8 years ago
by
Nicola Vigano
Browse files
Options
Downloads
Patches
Plain Diff
gtOarGetStats: fixed bug with matlab 2016a
Signed-off-by:
Nicola Vigano
<
nicola.vigano@esrf.fr
>
parent
afe2a0e8
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
zUtil_OAR/gtOarGetStats.m
+29
-19
29 additions, 19 deletions
zUtil_OAR/gtOarGetStats.m
with
29 additions
and
19 deletions
zUtil_OAR/gtOarGetStats.m
+
29
−
19
View file @
98756d05
function
stats
T
able
=
gtOarGetStats
(
IDs
,
vars
)
function
stats
_t
able
=
gtOarGetStats
(
IDs
,
vars
)
% GTOARGETSTATS Gets Oar stats for the given job IDs
% GTOARGETSTATS Gets Oar stats for the given job IDs
% -------------------------------------------------------------------------
% -------------------------------------------------------------------------
% statsTable = gtOarGetStats(IDs, vars)
% statsTable = gtOarGetStats(IDs, vars)
...
@@ -65,12 +65,11 @@ function statsTable = gtOarGetStats(IDs, vars)
...
@@ -65,12 +65,11 @@ function statsTable = gtOarGetStats(IDs, vars)
vars
=
newVars
;
vars
=
newVars
;
end
end
num_vars
=
numel
(
vars
);
if
(
isempty
(
IDs
))
if
(
isempty
(
IDs
))
stats
T
able
(
1
,
:)
=
vars
(:);
stats
_t
able
(
1
,
:)
=
vars
(:);
stats
T
able
(
2
,
:)
=
cellfun
(
@
(
x
){[]},
vars
(:));
stats
_t
able
(
2
,
:)
=
cellfun
(
@
(
x
){[]},
vars
(:));
stats
T
able
=
struct
(
stats
T
able
{:});
stats
_t
able
=
struct
(
stats
_t
able
{:});
return
;
return
;
end
end
...
@@ -79,41 +78,52 @@ function statsTable = gtOarGetStats(IDs, vars)
...
@@ -79,41 +78,52 @@ function statsTable = gtOarGetStats(IDs, vars)
% Getting the output
% Getting the output
[
~
,
output
]
=
system
(
jobsStr
);
[
~
,
output
]
=
system
(
jobsStr
);
[
stats_table
,
incomplete_logs
]
=
parse_oar_output
(
vars
,
output
);
if
(
incomplete_logs
)
fprintf
(
'\nIncomplete logs for jobs: %s\n\n'
,
sprintf
(
' %d'
,
IDs
));
end
end
function
[
stats_table
,
incomplete_logs
]
=
parse_oar_output
(
vars
,
output
)
num_vars
=
numel
(
vars
);
% Now we chop the input:
% Now we chop the input:
jobsBlocks
=
regexp
(
output
(
1
:
end
-
1
),
'\n\n'
,
'split'
);
jobsBlocks
=
regexp
(
output
(
1
:
end
-
1
),
'\n\n'
,
'split'
);
stats
T
able
=
cell
(
2
,
num_vars
+
1
);
stats
_t
able
=
cell
(
2
,
num_vars
+
1
);
incomplete_logs
=
false
;
incomplete_logs
=
false
;
% Now extract info from the output of 'oarstat'
% Now extract info from the output of 'oarstat'
if
(
~
isempty
(
stats
T
able
))
if
(
~
isempty
(
stats
_t
able
))
stat_id
=
regexp
(
jobsBlocks
,
'Job_Id: (?<Job_Id>.*?)\n'
,
'names'
,
'once'
);
stat_id
=
regexp
(
jobsBlocks
,
'Job_Id: (?<Job_Id>.*?)\n'
,
'names'
,
'once'
);
stat_id
=
[
stat_id
{:}];
stat_id
=
[
stat_id
{:}];
stats
T
able
{
1
,
1
}
=
'Job_Id'
;
stats
_t
able
{
1
,
1
}
=
'Job_Id'
;
stats
T
able
{
2
,
1
}
=
arrayfun
(
@
(
x
){
str2double
(
x
.
(
'Job_Id'
))},
stat_id
);
stats
_t
able
{
2
,
1
}
=
arrayfun
(
@
(
x
){
str2double
(
x
.
(
'Job_Id'
))},
stat_id
);
for
ii_v
=
1
:
num_vars
for
ii_v
=
1
:
num_vars
stat
=
regexp
(
jobsBlocks
,
[
vars
{
ii_v
}
' = (?<'
vars
{
ii_v
}
'>.*?)\n'
],
'names'
,
'once'
);
stat
=
regexp
(
jobsBlocks
,
[
vars
{
ii_v
}
' = (?<'
vars
{
ii_v
}
'>.*?)\n'
],
'names'
,
'once'
);
for
ii_c
=
numel
(
stat
):
-
1
:
1
for
ii_c
=
numel
(
stat
):
-
1
:
1
stat_struct
(
ii_c
)
.
(
vars
{
ii_v
})
=
stat
{
ii_c
}
.
(
vars
{
ii_v
});
if
(
~
isempty
(
stat
{
ii_c
}))
stat_struct
(
ii_c
)
.
(
vars
{
ii_v
})
=
stat
{
ii_c
}
.
(
vars
{
ii_v
});
else
stat_struct
(
ii_c
)
.
(
vars
{
ii_v
})
=
''
;
end
end
end
stat
=
stat_struct
;
stat
=
stat_struct
;
stats
T
able
{
1
,
ii_v
+
1
}
=
vars
{
ii_v
};
stats
_t
able
{
1
,
ii_v
+
1
}
=
vars
{
ii_v
};
stats
T
able
{
2
,
ii_v
+
1
}
=
{
stat
.
(
vars
{
ii_v
})};
stats
_t
able
{
2
,
ii_v
+
1
}
=
{
stat
.
(
vars
{
ii_v
})};
if
(
isempty
(
stats
T
able
{
2
,
ii_v
+
1
}))
if
(
isempty
(
stats
_t
able
{
2
,
ii_v
+
1
}))
warning
(
'gtOarGetStats:no_such_stat'
,
...
warning
(
'gtOarGetStats:no_such_stat'
,
...
[
'The stat "%s" is not reported in the output from '
...
[
'The stat "%s" is not reported in the output from '
...
'oarstat. This might create further errors.\n'
],
...
'oarstat. This might create further errors.\n'
],
...
vars
{
ii_v
});
vars
{
ii_v
});
incomplete_logs
=
true
;
incomplete_logs
=
true
;
stats
T
able
{
2
,
ii_v
+
1
}
=
cell
(
1
,
numel
(
stat_id
));
stats
_t
able
{
2
,
ii_v
+
1
}
=
cell
(
1
,
numel
(
stat_id
));
end
end
end
end
stats
T
able
=
struct
(
stats
T
able
{:});
stats
_t
able
=
struct
(
stats
_t
able
{:});
end
end
end
if
(
incomplete_logs
)
fprintf
(
'\nIncomplete logs for jobs: %s\n\n'
,
sprintf
(
' %d'
,
IDs
));
end
end
% end of function
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