Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
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
RadioObservatory
LOFAR
Commits
d01aa204
Commit
d01aa204
authored
4 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-156
: implemented updateActiveList and updateFinishedList for TMSS. Use TMSS-status-strings
parent
fdec19a8
No related branches found
No related tags found
1 merge request
!116
TMSS-156: Resolve TMSS-156
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc
+88
-17
88 additions, 17 deletions
MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc
with
88 additions
and
17 deletions
MAC/APL/MainCU/src/MACScheduler/MACScheduler.cc
+
88
−
17
View file @
d01aa204
...
...
@@ -629,7 +629,7 @@ GCFEvent::TResult MACScheduler::active_state(GCFEvent& event, GCFPortInterface&
}
else
#endif
itsTMSSconnection
->
setSubtaskState
(
theObs
->
second
,
"
active
"
);
itsTMSSconnection
->
setSubtaskState
(
theObs
->
second
,
"
started
"
);
break
;
}
...
...
@@ -648,7 +648,7 @@ GCFEvent::TResult MACScheduler::active_state(GCFEvent& event, GCFPortInterface&
tm
.
setTreeState
(
theObs
->
second
,
tsc
.
get
(
"completing"
));
}
else
#endif
itsTMSSconnection
->
setSubtaskState
(
theObs
->
second
,
"
complet
ing"
);
itsTMSSconnection
->
setSubtaskState
(
theObs
->
second
,
"
finish
ing"
);
break
;
}
...
...
@@ -925,9 +925,6 @@ void MACScheduler::_updatePlannedList()
boost
::
split
(
tmp
,
url
,
[](
char
c
){
return
c
==
'/'
;});
int
subtask_id
=
stoi
(
tmp
[
tmp
.
size
()
-
2
]);
// std::cout << "Wrote parset to " << filename << std::endl;
// _setParsetOnMsgBus(filename);
// construct name and timings info for observation
string
obsName
(
observationName
(
subtask_id
));
ptime
start_time
=
time_from_string
(
subtask
[
"start_time"
].
asString
().
replace
(
10
,
1
,
" "
));
...
...
@@ -1039,19 +1036,17 @@ void MACScheduler::_updateActiveList()
{
LOG_DEBUG
(
"_updateActiveList()"
);
GCFPValueArray
activeArr
;
#ifndef DONT_COMPILE_OTDB_AND_PVSS_CODE
// get new list (list is ordered on starttime)
vector
<
OTDBtree
>
activeDBlist
=
itsOTDBconnection
->
getTreeGroup
(
2
,
0
,
itsExclPLcluster
);
if
(
activeDBlist
.
empty
())
{
LOG_DEBUG
(
"No active Observations"
);
LOG_DEBUG
(
"No active
OTDB
Observations"
);
// NOTE: do not exit routine on emptylist: we need to write an empty list to clear the DB
}
#endif
// walk through the list, prepare PVSS for the new obs, update own admin lists.
GCFPValueArray
activeArr
;
#ifndef DONT_COMPILE_OTDB_AND_PVSS_CODE
int32
idx
=
activeDBlist
.
size
()
-
1
;
for
(
;
idx
>=
0
;
idx
--
)
{
if
(
activeDBlist
[
idx
].
processType
==
"RESERVATION"
||
activeDBlist
[
idx
].
processType
==
"MAINTENANCE"
)
{
...
...
@@ -1070,8 +1065,45 @@ void MACScheduler::_updateActiveList()
}
// for
#endif
// Finally we can pass the list with active observations to PVSS.
// get new list (list is/should_be ordered on starttime)
Json
::
Value
activeSubTasks
=
itsTMSSconnection
->
getActiveSubTasks
();
if
(
activeSubTasks
.
empty
())
{
LOG_DEBUG
(
"No active TMSS Observations"
);
// NOTE: do not exit routine on emptylist: we need to write an empty list to clear the DB
}
// walk through the list, prepare PVSS for the new obs, update own admin lists.
int32
idx
=
activeSubTasks
.
size
()
-
1
;
for
(
;
idx
>=
0
;
idx
--
)
{
Json
::
Value
subtask
=
activeSubTasks
[
idx
];
// if (subtask.processType=="RESERVATION" || subtask.processType=="MAINTENANCE") {
// continue;
// }
// get subtask_id from url. I know, ugly, needs to be in json itself.
vector
<
string
>
tmp
;
string
url
(
subtask
[
"url"
].
asString
());
boost
::
split
(
tmp
,
url
,
[](
char
c
){
return
c
==
'/'
;});
int
subtask_id
=
stoi
(
tmp
[
tmp
.
size
()
-
2
]);
// construct name and timings info for observation
string
obsName
(
observationName
(
subtask_id
));
ptime
start_time
=
time_from_string
(
subtask
[
"start_time"
].
asString
().
replace
(
10
,
1
,
" "
));
ptime
modTime
=
time_from_string
(
subtask
[
"updated_at"
].
asString
().
replace
(
10
,
1
,
" "
));
activeArr
.
push_back
(
new
GCFPVString
(
obsName
));
// remove obs from planned-list if its still in there.
OLiter
prepIter
=
itsPreparedObs
.
find
(
subtask_id
);
if
(
prepIter
!=
itsPreparedObs
.
end
())
{
itsPreparedObs
.
erase
(
prepIter
);
}
}
// for
#ifndef DONT_COMPILE_OTDB_AND_PVSS_CODE
// Finally we can pass the list with active observations to PVSS.
itsPropertySet
->
setValue
(
PN_MS_ACTIVE_OBSERVATIONS
,
GCFPVDynArr
(
LPT_DYNSTRING
,
activeArr
));
#endif
...
...
@@ -1090,21 +1122,19 @@ void MACScheduler::_updateFinishedList()
{
LOG_DEBUG
(
"_updateFinishedList()"
);
GCFPValueArray
finishedArr
;
int32
freeSpace
=
MAX_CONCURRENT_OBSERVATIONS
-
itsNrPlanned
-
itsNrActive
;
#ifndef DONT_COMPILE_OTDB_AND_PVSS_CODE
// get new list (list is ordered on starttime)
vector
<
OTDBtree
>
finishedDBlist
=
itsOTDBconnection
->
getTreeGroup
(
3
,
itsFinishedPeriod
,
itsExclPLcluster
);
if
(
finishedDBlist
.
empty
())
{
LOG_DEBUG
(
"No finish
ed
Observations"
);
LOG_DEBUG
(
"No finish
ing OTDB
Observations"
);
// NOTE: do not exit routine on emptylist: we need to write an empty list to clear the DB
}
#endif
// walk through the list, prepare PVSS for the new obs, update own admin lists.
// We must show the last part of the (optional) limited list.
GCFPValueArray
finishedArr
;
int32
freeSpace
=
MAX_CONCURRENT_OBSERVATIONS
-
itsNrPlanned
-
itsNrActive
;
#ifndef DONT_COMPILE_OTDB_AND_PVSS_CODE
int32
idx
=
finishedDBlist
.
size
()
-
1
;
int32
limit
=
idx
-
(
MIN2
(
MIN2
(
finishedDBlist
.
size
(),
itsMaxFinished
),
(
uint32
)
freeSpace
)
-
1
);
for
(
;
idx
>=
limit
;
idx
--
)
{
...
...
@@ -1116,8 +1146,49 @@ void MACScheduler::_updateFinishedList()
string
obsName
(
observationName
(
finishedDBlist
[
idx
].
treeID
()));
finishedArr
.
push_back
(
new
GCFPVString
(
obsName
));
}
// for
// Finally we can pass the list with finished observations to PVSS.
itsPropertySet
->
setValue
(
PN_MS_FINISHED_OBSERVATIONS
,
GCFPVDynArr
(
LPT_DYNSTRING
,
finishedArr
));
// free used memory
for
(
int
i
=
finishedArr
.
size
()
-
1
;
i
>=
0
;
--
i
)
{
delete
finishedArr
[
i
];
}
#endif
//reset for TMSS
finishedArr
=
GCFPValueArray
();
freeSpace
=
MAX_CONCURRENT_OBSERVATIONS
-
itsNrPlanned
-
itsNrActive
;
// get new list (list is/should_be ordered on starttime)
Json
::
Value
finishingSubTasks
=
itsTMSSconnection
->
getFinishingSubTasks
();
if
(
finishingSubTasks
.
empty
())
{
LOG_DEBUG
(
"No finishing TMSS Observations"
);
// NOTE: do not exit routine on emptylist: we need to write an empty list to clear the DB
}
// walk through the list, prepare PVSS for the new obs, update own admin lists.
// We must show the last part of the (optional) limited list.
int32
idx
=
finishingSubTasks
.
size
()
-
1
;
int32
limit
=
idx
-
(
MIN2
(
MIN2
(
finishingSubTasks
.
size
(),
itsMaxFinished
),
(
uint32
)
freeSpace
)
-
1
);
for
(
;
idx
>=
limit
;
idx
--
)
{
Json
::
Value
subtask
=
finishingSubTasks
[
idx
];
// if (subtask.processType=="RESERVATION" || subtask.processType=="MAINTENANCE") {
// continue;
// }
// get subtask_id from url. I know, ugly, needs to be in json itself.
vector
<
string
>
tmp
;
string
url
(
subtask
[
"url"
].
asString
());
boost
::
split
(
tmp
,
url
,
[](
char
c
){
return
c
==
'/'
;});
int
subtask_id
=
stoi
(
tmp
[
tmp
.
size
()
-
2
]);
// construct name info for observation
string
obsName
(
observationName
(
subtask_id
));
finishedArr
.
push_back
(
new
GCFPVString
(
obsName
));
}
// for
// Finally we can pass the list with finished observations to PVSS.
#ifndef DONT_COMPILE_OTDB_AND_PVSS_CODE
itsPropertySet
->
setValue
(
PN_MS_FINISHED_OBSERVATIONS
,
GCFPVDynArr
(
LPT_DYNSTRING
,
finishedArr
));
...
...
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