def testrunApPipeGen3Steps(self, mockDb, mockFwk): """Test that runApPipeGen3 runs the entire pipeline. """ pipeline_driver.runApPipeGen3(self.workspace, self.apPipeArgs) mockDb.assert_called_once() mockFwk().parseAndRun.assert_called_once()
def testrunApPipeGen3Reuse(self, _mockDb, mockFwk): """Test that runApPipeGen2 does not run the pipeline at all (not even with --skip-existing) if --skip-pipeline is provided. """ skipArgs = pipeline_driver.ApPipeParser().parse_args( ["--skip-pipeline"]) pipeline_driver.runApPipeGen3(self.workspace, skipArgs) mockFwk().parseAndRun.assert_not_called()
def testrunApPipeGen3WorkspaceCustom(self, mockDb, mockFwk): """Test that runApPipeGen3 places a database in the specified location. """ self.apPipeArgs.db = "postgresql://[email protected]/custom_db" pipeline_driver.runApPipeGen3(self.workspace, self.apPipeArgs) mockDb.assert_called_once() cmdLineArgs = self._getCmdLineArgs(mockDb.call_args) self.assertIn("db_url=" + self.apPipeArgs.db, cmdLineArgs) mockParse = mockFwk().parseAndRun mockParse.assert_called_once() cmdLineArgs = self._getCmdLineArgs(mockParse.call_args) self.assertIn("diaPipe:apdb.db_url=" + self.apPipeArgs.db, cmdLineArgs)
def testrunApPipeGen3WorkspaceCustom(self, mockDb): """Test that runApPipeGen3 places a database in the specified location. """ self.apPipeArgs.db = "postgresql://[email protected]/custom_db" pipeline_driver.runApPipeGen3(self.workspace, self.apPipeArgs) # Test the call to make_apdb.py mockDb.assert_called_once() cmdLineArgs = self._getCmdLineArgs(mockDb.call_args) self.assertIn("db_url=" + self.apPipeArgs.db, cmdLineArgs) # Test the call to the AP pipeline id = _getDataIds(self.workspace.analysisButler)[0] apdbConfig = self.workspace.analysisButler.get("apdb_marker", id) self.assertEqual(apdbConfig.db_url, self.apPipeArgs.db)
def testrunApPipeGen3WorkspaceDb(self, mockDb, mockFwk): """Test that runApPipeGen3 places a database in the workspace location by default. """ pipeline_driver.runApPipeGen3(self.workspace, self.apPipeArgs) mockDb.assert_called_once() cmdLineArgs = self._getCmdLineArgs(mockDb.call_args) self.assertIn("db_url=sqlite:///" + self.workspace.dbLocation, cmdLineArgs) mockParse = mockFwk().parseAndRun mockParse.assert_called_once() cmdLineArgs = self._getCmdLineArgs(mockParse.call_args) self.assertIn( "diaPipe:apdb.db_url=sqlite:///" + self.workspace.dbLocation, cmdLineArgs)
def testrunApPipeGen3WorkspaceDb(self, mockDb): """Test that runApPipeGen3 places a database in the workspace location by default. """ pipeline_driver.runApPipeGen3(self.workspace, self.apPipeArgs) # Test the call to make_apdb.py mockDb.assert_called_once() cmdLineArgs = self._getCmdLineArgs(mockDb.call_args) self.assertIn("db_url=sqlite:///" + self.workspace.dbLocation, cmdLineArgs) # Test the call to the AP pipeline id = _getDataIds(self.workspace.analysisButler)[0] apdbConfig = self.workspace.analysisButler.get("apdb_marker", id) self.assertEqual(apdbConfig.db_url, "sqlite:///" + self.workspace.dbLocation)
def testrunApPipeGen3Reuse(self): """Test that runApPipeGen3 does not run the pipeline at all (not even with --skip-existing) if --skip-pipeline is provided. """ skipArgs = pipeline_driver.ApPipeParser().parse_args( ["--skip-pipeline"]) pipeline_driver.runApPipeGen3(self.workspace, skipArgs) # Use datasets as a proxy for pipeline completion. # Depending on the overall test setup, the dataset may or may not be # registered if the pipeline didn't run; check both cases. id = _getDataIds(self.workspace.analysisButler)[0] calexpQuery = set( self.workspace.analysisButler.registry.queryDatasetTypes("calexp")) calexpExists = len(calexpQuery) > 0 self.assertFalse( calexpExists and self.workspace.analysisButler.datasetExists("calexp", id))
def testrunApPipeGen3Steps(self): """Test that runApPipeGen3 runs the entire pipeline. """ pipeline_driver.runApPipeGen3(self.workspace, self.apPipeArgs) # Use datasets as a proxy for pipeline completion id = _getDataIds(self.workspace.analysisButler)[0] self.assertTrue( self.workspace.analysisButler.datasetExists("calexp", id)) self.assertTrue(self.workspace.analysisButler.datasetExists("src", id)) self.assertTrue( self.workspace.analysisButler.datasetExists( "goodSeeingDiff_differenceExp", id)) self.assertTrue( self.workspace.analysisButler.datasetExists( "goodSeeingDiff_diaSrc", id)) self.assertTrue( self.workspace.analysisButler.datasetExists("apdb_marker", id)) self.assertTrue( self.workspace.analysisButler.datasetExists( "goodSeeingDiff_assocDiaSrc", id))