All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit e24e0d91 authored by Christopher Alfeld's avatar Christopher Alfeld

Modified to do locking and store ptop file in /tmp.

parent c43de311
......@@ -14,6 +14,19 @@ proc outs {args} {
puts $logFp $s
proc unlock {} {
global lockfile
outs "Unlocking the world!"
if {! [file exists $lockfile]} {
outs stderr "Error: World already unlocked - DB may be corrupted."
} else {
if {[catch "file delete -force $lockfile" err]} {
outs stderr "Error unlocking world ($err)"
### Bootstrapping code. The whole purpose of this is to find the
# directory containing the script.
set file [info script]
......@@ -26,6 +39,7 @@ if {$scriptdir == "."} {set scriptdir [pwd]}
set updir [file dirname $scriptdir]
set lockfile "/usr/testbed/etc/tblock"
set ns2ir "$updir/ir/ns2ir/parse.tcl"
set assign "$updir/ir/assign.tcl"
set handle_ip "$updir/ir/handle_ip.tcl"
......@@ -75,15 +89,32 @@ if {! [file exists $irFile]} {
exit 1
outs "Locking the world!"
set wait {15 30 60 600 600}
set waiti 0
while {[catch "open $lockfile {WRONLY CREAT EXCL}" lockfp]} {
if {$wait == [llength $waiti]} {
outs stderr "Giving up on locking. If no other tbprerun is running then remove $lockfile manually."
exit 1
set delay [lindex $wait $waiti]
incr waiti
outs "World is locked. Waiting $delay seconds"
after [expr $delay * 1000]
close $lockfp
outs "Determining available resources."
if {[catch "exec $avail type=pc ver extras | $ptopgen > $ptopfile 2>@ $logFp" err]} {
outs stderr "Error determining available resources. ($err)"
exit 1
outs "Allocating resources - This may take a while."
if {[catch "exec $assign $irFile $ptopfile >@ $logFp 2>@ $logFp" err]} {
outs stderr "Error allocating resources. ($err)"
outs stderr "Error allocating resources. See $logFile and assign.log for more info."
exit 1
......@@ -97,9 +128,12 @@ foreach pair $nodemap {
outs "Reserving resources."
if {[catch "exec $reserve $prefix $machines >@ $logFp 2>@ $logFp" err]} {
outs stderr "Error reserving resources. ($err)"
exit 1
outs "Allocating IP addresses."
if {[catch "exec $handle_ip $irFile $nsFile >@ $logFp 2>@ $logFp" err]} {
outs stderr "Error allocating IP addresses. ($err)"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment