当前位置: 首页>>代码示例>>Java>>正文


Java JobStats.isSuccessful方法代码示例

本文整理汇总了Java中org.apache.pig.tools.pigstats.JobStats.isSuccessful方法的典型用法代码示例。如果您正苦于以下问题:Java JobStats.isSuccessful方法的具体用法?Java JobStats.isSuccessful怎么用?Java JobStats.isSuccessful使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.pig.tools.pigstats.JobStats的用法示例。


在下文中一共展示了JobStats.isSuccessful方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getJobs

import org.apache.pig.tools.pigstats.JobStats; //导入方法依赖的package包/类
/**
 * Retrieves a list of Job objects from the PigStats object
 * @param stats
 * @return A list of ExecJob objects
 */
protected List<ExecJob> getJobs(PigStats stats) {
    LinkedList<ExecJob> jobs = new LinkedList<ExecJob>();
    JobGraph jGraph = stats.getJobGraph();
    Iterator<JobStats> iter = jGraph.iterator();
    while (iter.hasNext()) {
        JobStats js = iter.next();
        for (OutputStats output : js.getOutputs()) {
            if (js.isSuccessful()) {
                jobs.add(new HJob(HJob.JOB_STATUS.COMPLETED, pigContext, output
                        .getPOStore(), output.getAlias(), stats));
            } else {
                HJob hjob = new HJob(HJob.JOB_STATUS.FAILED, pigContext, output
                        .getPOStore(), output.getAlias(), stats);
                hjob.setException(js.getException());
                jobs.add(hjob);
            }
        }
    }
    return jobs;
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:26,代码来源:PigServer.java

示例2: executePlan

import org.apache.pig.tools.pigstats.JobStats; //导入方法依赖的package包/类
private boolean executePlan(PhysicalPlan pp) throws IOException {
    boolean failed = true;
    MapReduceLauncher launcher = new MapReduceLauncher();
    PigStats stats = null;
    try {
        stats = launcher.launchPig(pp, "execute", myPig.getPigContext());
    } catch (Exception e) {
        e.printStackTrace(System.out);
        throw new IOException(e);
    }
    Iterator<JobStats> iter = stats.getJobGraph().iterator();
    while (iter.hasNext()) {
        JobStats js = iter.next();
        failed = !js.isSuccessful();
        if (failed) {
            break;
        }
    }
    return !failed;
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:21,代码来源:TestMultiQueryLocal.java

示例3: executeBatch

import org.apache.pig.tools.pigstats.JobStats; //导入方法依赖的package包/类
private void executeBatch() throws IOException {
    if (mPigServer.isBatchOn()) {
        if (mExplain != null) {
            explainCurrentBatch();
        }

        if (!mLoadOnly) {
            mPigServer.executeBatch();
            PigStats stats = PigStats.get();
            JobGraph jg = stats.getJobGraph();
            Iterator<JobStats> iter = jg.iterator();
            while (iter.hasNext()) {
                JobStats js = iter.next();
                if (!js.isSuccessful()) {
                    mNumFailedJobs++;
                    Exception exp = (js.getException() != null) ? js.getException()
                            : new ExecException(
                                    "Job failed, hadoop does not return any error message",
                                    2244);
                    LogUtils.writeLog(exp,
                            mPigServer.getPigContext().getProperties().getProperty("pig.logfile"),
                            log,
                            "true".equalsIgnoreCase(mPigServer.getPigContext().getProperties().getProperty("verbose")),
                            "Pig Stack Trace");
                } else {
                    mNumSucceededJobs++;
                }
            }
        }
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:32,代码来源:GruntParser.java

示例4: testStopOnFailure

import org.apache.pig.tools.pigstats.JobStats; //导入方法依赖的package包/类
/**
 * PIG-2780: In this test case, Pig submits three jobs at the same time and
 * one of them will fail due to nonexistent input file. If users enable
 * stop.on.failure, then Pig should immediately stop if anyone of the three
 * jobs has failed.
 */
@Test
public void testStopOnFailure() throws Exception {
    
    PrintWriter w1 = new PrintWriter(new FileWriter(PIG_FILE));
    w1.println("A1 = load '" + INPUT_FILE + "';");
    w1.println("B1 = load 'nonexist';");
    w1.println("C1 = load '" + INPUT_FILE + "';");
    w1.println("A2 = distinct A1;");
    w1.println("B2 = distinct B1;");
    w1.println("C2 = distinct C1;");
    w1.println("ret = union A2,B2,C2;");
    w1.println("store ret into 'tmp/output';");
    w1.close();
    
    try {
        String[] args = { "-F", PIG_FILE };
        PigStats stats = PigRunner.run(args, new TestNotificationListener());
 
        assertTrue(!stats.isSuccessful());
        
        int successfulJobs = 0;
        Iterator<Operator> it = stats.getJobGraph().getOperators();
        while (it.hasNext()){
            JobStats js = (JobStats)it.next();
            if (js.isSuccessful())
                successfulJobs++;
        }
        
        // we should have less than 2 successful jobs
        assertTrue("Should have less than 2 successful jobs", successfulJobs < 2);
        
    } finally {
        new File(PIG_FILE).delete();
        Util.deleteFile(cluster, OUTPUT_FILE);
        Util.deleteFile(cluster, "tmp/output");
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:44,代码来源:TestPigRunner.java

示例5: executeBatch

import org.apache.pig.tools.pigstats.JobStats; //导入方法依赖的package包/类
private void executeBatch() throws IOException {
    if (mPigServer.isBatchOn()) {
        if (mExplain != null) {
            explainCurrentBatch();
        }

        if (!mLoadOnly) {
            mPigServer.executeBatch();
            PigStats stats = PigStats.get();
            JobGraph jg = stats.getJobGraph();
            Iterator<JobStats> iter = jg.iterator();
            while (iter.hasNext()) {
                JobStats js = iter.next();
                if (!js.isSuccessful()) {
                    mNumFailedJobs++;
                    Exception exp = (js.getException() != null) ? js.getException()
                            : new ExecException(
                                    "Job " + (js.getJobId() == null ? "" : js.getJobId() + " ") +
                                    "failed, hadoop does not return any error message",
                                    2244);
                    LogUtils.writeLog(exp,
                            mPigServer.getPigContext().getProperties().getProperty("pig.logfile"),
                            log,
                            "true".equalsIgnoreCase(mPigServer.getPigContext().getProperties().getProperty("verbose")),
                            "Pig Stack Trace");
                } else {
                    mNumSucceededJobs++;
                }
            }
        }
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:33,代码来源:GruntParser.java

示例6: getJobs

import org.apache.pig.tools.pigstats.JobStats; //导入方法依赖的package包/类
/**
 * Retrieves a list of Job objects from the PigStats object
 * @param stats
 * @return A list of ExecJob objects
 */
protected List<ExecJob> getJobs(PigStats stats) {
    LinkedList<ExecJob> jobs = new LinkedList<ExecJob>();
    if (stats instanceof EmptyPigStats) {
        HJob job = new HJob(HJob.JOB_STATUS.COMPLETED, pigContext, stats.result(null)
                .getPOStore(), null);
        jobs.add(job);
        return jobs;
    }
    JobGraph jGraph = stats.getJobGraph();
    Iterator<JobStats> iter = jGraph.iterator();
    while (iter.hasNext()) {
        JobStats js = iter.next();
        for (OutputStats output : js.getOutputs()) {
            if (js.isSuccessful()) {
                jobs.add(new HJob(HJob.JOB_STATUS.COMPLETED, pigContext, output
                        .getPOStore(), output.getAlias(), stats));
            } else {
                HJob hjob = new HJob(HJob.JOB_STATUS.FAILED, pigContext, output
                        .getPOStore(), output.getAlias(), stats);
                hjob.setException(js.getException());
                jobs.add(hjob);
            }
        }
    }
    return jobs;
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:32,代码来源:PigServer.java

示例7: testStopOnFailure

import org.apache.pig.tools.pigstats.JobStats; //导入方法依赖的package包/类
/**
 * PIG-2780: In this test case, Pig submits three jobs at the same time and
 * one of them will fail due to nonexistent input file. If users enable
 * stop.on.failure, then Pig should immediately stop if anyone of the three
 * jobs has failed.
 */
@Test
public void testStopOnFailure() throws Exception {

    PrintWriter w1 = new PrintWriter(new FileWriter(PIG_FILE));
    w1.println("A1 = load '" + INPUT_FILE + "';");
    w1.println("B1 = load 'nonexist';");
    w1.println("C1 = load '" + INPUT_FILE + "';");
    w1.println("A2 = distinct A1;");
    w1.println("B2 = distinct B1;");
    w1.println("C2 = distinct C1;");
    w1.println("ret = union A2,B2,C2;");
    w1.println("store ret into 'tmp/output';");
    w1.close();

    try {
        String[] args = { "-x", execType, "-F", PIG_FILE };
        PigStats stats = PigRunner.run(args, new TestNotificationListener(execType));

        assertTrue(!stats.isSuccessful());

        int successfulJobs = 0;
        Iterator<Operator> it = stats.getJobGraph().getOperators();
        while (it.hasNext()){
            JobStats js = (JobStats)it.next();
            if (js.isSuccessful())
                successfulJobs++;
        }

        // we should have less than 2 successful jobs
        assertTrue("Should have less than 2 successful jobs", successfulJobs < 2);

    } finally {
        new File(PIG_FILE).delete();
        Util.deleteFile(cluster, OUTPUT_FILE);
        Util.deleteFile(cluster, "tmp/output");
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:44,代码来源:TestPigRunner.java

示例8: executeBatch

import org.apache.pig.tools.pigstats.JobStats; //导入方法依赖的package包/类
private void executeBatch() throws IOException {
    if (mPigServer.isBatchOn()) {
        if (mExplain != null) {
            explainCurrentBatch();
        }

        if (!mLoadOnly) {
            mPigServer.executeBatch();
            PigStats stats = PigStats.get();
            JobGraph jg = stats.getJobGraph();
            Iterator<JobStats> iter = jg.iterator();
            while (iter.hasNext()) {
                JobStats js = iter.next();
                if (!js.isSuccessful()) {
                    mNumFailedJobs++;
                    Exception exp = (js.getException() != null) ? js.getException()
                            : new ExecException(
                                    "Job failed, hadoop does not return any error message",
                                    2244);                        
                    LogUtils.writeLog(exp, 
                            mPigServer.getPigContext().getProperties().getProperty("pig.logfile"), 
                            log, 
                            "true".equalsIgnoreCase(mPigServer.getPigContext().getProperties().getProperty("verbose")),
                            "Pig Stack Trace");
                } else {
                    mNumSucceededJobs++;
                }
            }
        }
    }
}
 
开发者ID:PonIC,项目名称:PonIC,代码行数:32,代码来源:GruntParser.java


注:本文中的org.apache.pig.tools.pigstats.JobStats.isSuccessful方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。