Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
7196f795
Commit
7196f795
authored
Jun 18, 2004
by
Leigh B. Stoller
Browse files
Fix up batch daemon to terminate more than one batch experiment at a
time. Silly, silly, silly ...
parent
4218c73c
Changes
1
Hide whitespace changes
Inline
Side-by-side
tbsetup/batch_daemon.in
View file @
7196f795
...
...
@@ -106,7 +106,7 @@ if (@ARGV != 0) {
usage
();
}
if
(
defined
(
$options
{"
d
"}))
{
$debug
=
$options
{"
d
"}
;
$debug
=
1
;
}
# Go to ground.
...
...
@@ -172,7 +172,7 @@ while (1) {
$running_result
=
DBQuery
("
select * from experiments
"
.
"
where batchmode=1 and state='
$BSTATE_RUNNING
'
"
.
"
ORDER BY expt_start
LIMIT 1
");
"
ORDER BY expt_start
");
if
(
!
$pending_result
||
!
$running_result
)
{
print
"
DB Error getting batch info. Waiting a bit ...
\n
";
...
...
@@ -218,29 +218,47 @@ while (1) {
#
# If you are wondering why I check for finished experiments in the main
# loop instead of in the child that started the experiment, its so that
# we fire up again and look for them in the event that
paper
goes down.
# we fire up again and look for them in the event that
boss
goes down.
#
if
(
!
$running_result
->
numrows
)
{
DBQueryWarn
("
unlock tables
");
}
else
{
my
%running_row
=
$running_result
->
fetchhash
();
my
$canceled
=
$running_row
{'
canceled
'};
# Local vars!
my
$eid
=
$running_row
{'
eid
'};
my
$pid
=
$running_row
{'
pid
'};
my
%canterm
=
();
while
(
my
%running_row
=
$running_result
->
fetchhash
())
{
# Local vars!
my
$eid
=
$running_row
{'
eid
'};
my
$pid
=
$running_row
{'
pid
'};
#
# Lock so user cannot mess with it.
#
$query_result
=
DBQuery
("
update experiments set
"
.
"
expt_locked=now(),
"
.
"
batchstate='
$BSTATE_LOCKED
'
"
.
"
where eid='
$eid
' and pid='
$pid
'
");
#
# Lock so user cannot mess with it.
#
$query_result
=
DBQuery
("
update experiments set
"
.
"
expt_locked=now(),
"
.
"
batchstate='
$BSTATE_LOCKED
'
"
.
"
where eid='
$eid
' and pid='
$pid
'
");
$canterm
{"
$pid
:
$eid
"}
=
(
$query_result
?
1
:
0
);
}
DBQueryWarn
("
unlock tables
");
if
(
$query_result
)
{
#
# Reset and go through again.
#
$running_result
->
dataseek
(
0
);
while
(
my
%running_row
=
$running_result
->
fetchhash
())
{
my
$canceled
=
$running_row
{'
canceled
'};
# Local vars!
my
$eid
=
$running_row
{'
eid
'};
my
$pid
=
$running_row
{'
pid
'};
my
$canterm
=
$canterm
{"
$pid
:
$eid
"};
next
if
(
!
$canterm
);
if
(
$canceled
)
{
# Look at the cancel flag.
if
(
$canceled
==
EXPTCANCEL_TERM
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment