
macro setup
  module pantasks.pro
  detrend.modules

  module site.mhpcc.pro

  init.copy.mhpcc on
  queueload tmp -x "cat $MODULES:0/ipphosts.mhpcc.config"
  ipptool2book tmp ipphosts -key camera

  # XXX merge the above into init.site more cleanly (careful with summit copy stuff)
  # init.site (we do not use init.site because it loads the hosts)

  add.database gpc1
  set.poll 100
end

macro set.poll
  if ($0 != 2)
    echo "USAGE:set.poll (value)"
    break
  end
 
  $POLLLIMIT = $1
end

macro get.poll
  echo "poll limit: $POLLLIMIT"
end

macro load.hosts.wave1
  controller host add ipp005 -threads 4
  controller host add ipp006 -threads 4
# controller host add ipp007 -threads 4 (respawning?)
# controller host add ipp008 -threads 4 (flaky)
  controller host add ipp009 -threads 4
  controller host add ipp010 -threads 4
  controller host add ipp011 -threads 4
  controller host add ipp012 -threads 4
  controller host add ipp013 -threads 4
# controller host add ipp014 -threads 4
# controller host add ipp016 -threads 4 (flaky)
  controller host add ipp017 -threads 4
# controller host add ipp018 -threads 4 (flaky)
# controller host add ipp019 -threads 4 (nebulous)
  controller host add ipp020 -threads 4
  controller host add ipp021 -threads 4
end

macro load.hosts.wave2
  controller host add ipp015 -threads 4
  controller host add ipp017 -threads 4
  controller host add ipp023 -threads 4
  controller host add ipp024 -threads 4
  controller host add ipp026 -threads 4
  controller host add ipp027 -threads 4
  controller host add ipp028 -threads 4
  controller host add ipp029 -threads 4
  controller host add ipp030 -threads 4
  controller host add ipp031 -threads 4
  controller host add ipp032 -threads 4
  controller host add ipp033 -threads 4
  controller host add ipp034 -threads 4
  controller host add ipp035 -threads 4
  controller host add ipp036 -threads 4
end

macro load.hosts.wave3
  controller host add ipp038 -threads 4
  controller host add ipp039 -threads 4
  controller host add ipp040 -threads 4
  controller host add ipp041 -threads 4
  controller host add ipp042 -threads 4
  controller host add ipp043 -threads 4
  controller host add ipp044 -threads 4
  controller host add ipp045 -threads 4
  controller host add ipp046 -threads 4
  controller host add ipp047 -threads 4
  controller host add ipp048 -threads 4
  controller host add ipp049 -threads 4
  controller host add ipp050 -threads 4
  controller host add ipp051 -threads 4
  controller host add ipp052 -threads 4
  controller host add ipp053 -threads 4
end

macro load.hosts.compute
  controller host add ippc00 -threads 4
  controller host add ippc01 -threads 4
  controller host add ippc02 -threads 4
  controller host add ippc03 -threads 4
  controller host add ippc04 -threads 4
  controller host add ippc05 -threads 4
  controller host add ippc06 -threads 4
# controller host add ippc07 -threads 4 (pantasks - register)
  controller host add ippc08 -threads 4
  controller host add ippc09 -threads 4
# controller host add ippc10 -threads 4 (pantasks - stdscience)
  controller host add ippc11 -threads 4
  controller host add ippc12 -threads 4
  controller host add ippc13 -threads 4
  controller host add ippc14 -threads 4
  controller host add ippc15 -threads 4
  controller host add ippc16 -threads 4
  controller host add ippc17 -threads 4
  controller host add ippc18 -threads 4
  controller host add ippc19 -threads 4
end

macro show.book
  if ($0 != 2)
   echo "USAGE: show.book (book)"
   break
  end

  book npages $1 -var npages
  for i 0 $npages
    book getpage $1 $i -var pagename
    book listpage $1 $pagename
  end

  echo "npages: $npages"
end

macro del.page.from.book
  if ($0 != 3)
   echo "USAGE: show.book (book) (page)"
   break
  end

  book delpage $1 $2
end
