
TASK           test.phase1
  COMMAND      test.phase1
  HOST         -
  STDERR       log
  EXEC_PERIOD  30
  POLL_PERIOD  1

  # success
  EXIT         0
    STDOUT     @science.mosaics
  END

  # locked list
  EXIT         1
    MESSAGE    "new.images: exec failure"
    $new.image.failure ++
  END

  # operation times out?
  TIMEOUT      10
    MESSAGE    "db search failed"
  END
END

TASK           phase1
  REQUIRE      @science.mosaics > 0
  PERFORM      $line       = POP (@science.mosaics)
  PERFORM      $ExposureID = $line[0]

  COMMAND      phase1 $ExposureID
  STDERR       $log/phase1/$ExposureID.log
  EXEC_PERIOD  10

  # success
  EXIT         0
    STDOUT     @science.chips
  END

  TIMEOUT      10
    MESSAGE    "phase1: timeout $ExposureID"
    $phase1.failure ++
  END

END

TASK           test.phase2

TASK           phase2
  REQUIRE      @science.chips > 0
  PERFORM      $line       = POP (@science.mosaics)
  PERFORM      $ = $line[0]

  COMMAND      phase1 $ExposureID
  STDERR       $log/phase1/$ExposureID.log
  EXEC_PERIOD  10

  # success
  EXIT         0
    STDOUT     @science.chips
  END

  TIMEOUT      10
    MESSAGE    "phase1: timeout $ExposureID"
    $phase1.failure ++
  END

END
