Search in sources :

Example 6 with StoreException

use of org.apache.oozie.store.StoreException in project oozie by apache.

the class TestCoordELExtensions method checkCoordAction.

protected CoordinatorActionBean checkCoordAction(String actionId) throws StoreException {
    try {
        CoordinatorActionBean action = getCoordinatorAction(actionId);
        assertEquals("file://#testDir/2009/03/06/00/_SUCCESS#file://#testDir/2009/03/05/23/_SUCCESS", action.getMissingDependencies());
        return action;
    } catch (Exception se) {
        se.printStackTrace();
        fail("Action ID " + actionId + " was not stored properly in db");
    }
    return null;
}
Also used : CoordinatorActionBean(org.apache.oozie.CoordinatorActionBean) StoreException(org.apache.oozie.store.StoreException)

Example 7 with StoreException

use of org.apache.oozie.store.StoreException in project oozie by apache.

the class OozieDBExportCLI method queryAllDBTables.

private static void queryAllDBTables(String filename) throws StoreException, IOException {
    EntityManager manager = null;
    ZipOutputStream zos = null;
    File file = null;
    try {
        file = new File(filename);
        zos = new ZipOutputStream(new FileOutputStream(file));
        zos.setLevel(1);
        manager = Services.get().get(JPAService.class).getEntityManager();
        manager.setFlushMode(FlushModeType.COMMIT);
        int infoSize = exportTableToJSON(manager.createNativeQuery(GET_DB_VERSION), zos, OOZIEDB_SYS_INFO_JSON);
        System.out.println(infoSize + " rows exported from OOZIE_SYS");
        int wfjSize = exportTableToJSON(manager.createQuery(GET_WORKFLOW_JOBS), zos, OOZIEDB_WF_JSON);
        System.out.println(wfjSize + " rows exported from WF_JOBS");
        int wfaSize = exportTableToJSON(manager.createQuery(GET_WORKFLOW_ACTIONS), zos, OOZIEDB_AC_JSON);
        System.out.println(wfaSize + " rows exported from WF_ACTIONS");
        int cojSize = exportTableToJSON(manager.createQuery(GET_COORD_JOBS), zos, OOZIEDB_CJ_JSON);
        System.out.println(cojSize + " rows exported from COORD_JOBS");
        int coaSize = exportTableToJSON(manager.createQuery(GET_COORD_ACTIONS), zos, OOZIEDB_CA_JSON);
        System.out.println(coaSize + " rows exported from COORD_ACTIONS");
        int bnjSize = exportTableToJSON(manager.createQuery(GET_BUNDLE_JOBS), zos, OOZIEDB_BNJ_JSON);
        System.out.println(bnjSize + " rows exported from BUNDLE_JOBS");
        int bnaSize = exportTableToJSON(manager.createQuery(GET_BUNDLE_ACIONS), zos, OOZIEDB_BNA_JSON);
        System.out.println(bnaSize + " rows exported from BUNDLE_ACTIONS");
        int slaRegSize = exportTableToJSON(manager.createQuery(GET_SLA_REGISTRATIONS), zos, OOZIEDB_SLAREG_JSON);
        System.out.println(slaRegSize + " rows exported from SLA_REGISTRATION");
        int ssSize = exportTableToJSON(manager.createQuery(GET_SLA_SUMMARYS), zos, OOZIEDB_SLASUM_JSON);
        System.out.println(ssSize + " rows exported from SLA_SUMMARY");
    } catch (Exception e) {
        System.err.println("Error during dump creation: " + e.getMessage());
        System.err.println();
        e.printStackTrace(System.err);
        System.err.println();
        if (file != null) {
            file.delete();
        }
        System.exit(1);
    } finally {
        IOUtils.closeSafely(zos);
        if (manager != null) {
            manager.close();
        }
    }
}
Also used : EntityManager(javax.persistence.EntityManager) ZipOutputStream(java.util.zip.ZipOutputStream) FileOutputStream(java.io.FileOutputStream) File(java.io.File) IOException(java.io.IOException) ParseException(org.apache.commons.cli.ParseException) StoreException(org.apache.oozie.store.StoreException)

Aggregations

StoreException (org.apache.oozie.store.StoreException)7 Date (java.util.Date)5 CommandException (org.apache.oozie.command.CommandException)5 IOException (java.io.IOException)4 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)4 Path (org.apache.hadoop.fs.Path)3 Map (java.util.Map)2 Properties (java.util.Properties)2 Configuration (org.apache.hadoop.conf.Configuration)2 FileSystem (org.apache.hadoop.fs.FileSystem)2 CoordinatorActionBean (org.apache.oozie.CoordinatorActionBean)2 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)2 JPAService (org.apache.oozie.service.JPAService)2 WorkflowAppService (org.apache.oozie.service.WorkflowAppService)2 WorkflowStoreService (org.apache.oozie.service.WorkflowStoreService)2 XConfiguration (org.apache.oozie.util.XConfiguration)2 WorkflowApp (org.apache.oozie.workflow.WorkflowApp)2 WorkflowException (org.apache.oozie.workflow.WorkflowException)2 WorkflowInstance (org.apache.oozie.workflow.WorkflowInstance)2 WorkflowLib (org.apache.oozie.workflow.WorkflowLib)2