Exemplo n.º 1
0
    def testBadlyTypedKeys(self):
        metadata = self.scienceTask.getFullMetadata()
        endKeys = [
            key for key in metadata.paramNames(topLevelOnly=False)
            if "EndCpuTime" in key
        ]
        for key in endKeys:
            metadata.set(key, str(metadata.getAsDouble(key)))

        task = TimingMetricTask(config=self.config)
        with self.assertRaises(MetricComputationError):
            task.run(metadata)
Exemplo n.º 2
0
    def testNonsenseKeys(self):
        metadata = self.scienceTask.getFullMetadata()
        startKeys = [
            key for key in metadata.paramNames(topLevelOnly=False)
            if "StartCpuTime" in key
        ]
        for key in startKeys:
            metadata.remove(key)

        task = TimingMetricTask(config=self.config)
        with self.assertRaises(MetricComputationError):
            task.run(metadata)
Exemplo n.º 3
0
 def testRunDifferentMethod(self):
     self.config.target = DummyTask._DefaultName + ".runDataRef"
     task = TimingMetricTask(config=self.config)
     result = task.run(self.scienceTask.getFullMetadata())
     lsst.pipe.base.testUtils.assertValidOutput(task, result)
     meas = result.measurement
     self.assertIsNone(meas)
Exemplo n.º 4
0
 def testNoMetric(self):
     self.config.connections.package = "foo.bar"
     self.config.connections.metric = "FooBarTime"
     task = TimingMetricTask(config=self.config)
     with self.assertRaises(TypeError):
         task.run(self.scienceTask.getFullMetadata())
 def testRunDifferentMethod(self):
     self.config.target = DummyTask._DefaultName + ".runDataRef"
     task = TimingMetricTask(config=self.config)
     result = task.run([self.scienceTask.getFullMetadata()])
     meas = result.measurement
     self.assertIsNone(meas)
 def testNoMetric(self):
     self.config.metric = "foo.bar.FooBarTime"
     task = TimingMetricTask(config=self.config)
     with self.assertRaises(TypeError):
         task.run([self.scienceTask.getFullMetadata()])