Search in sources :

Example 46 with JobId

use of org.apache.hyracks.api.job.JobId in project asterixdb by apache.

the class JobManagerTest method mockJobRun.

private JobRun mockJobRun(long id) {
    JobRun run = mock(JobRun.class, Mockito.RETURNS_DEEP_STUBS);
    when(run.getExceptions()).thenReturn(Collections.emptyList());
    when(run.getActivityClusterGraph().isReportTaskDetails()).thenReturn(true);
    when(run.getPendingExceptions()).thenReturn(Collections.emptyList());
    JobId jobId = new JobId(id);
    when(run.getJobId()).thenReturn(jobId);
    Set<String> nodes = new HashSet<>();
    nodes.add("node1");
    nodes.add("node2");
    when(run.getParticipatingNodeIds()).thenReturn(nodes);
    when(run.getCleanupPendingNodeIds()).thenReturn(nodes);
    return run;
}
Also used : JobId(org.apache.hyracks.api.job.JobId) HashSet(java.util.HashSet)

Example 47 with JobId

use of org.apache.hyracks.api.job.JobId in project asterixdb by apache.

the class Sort method main.

public static void main(String[] args) throws Exception {
    Options options = new Options();
    CmdLineParser parser = new CmdLineParser(options);
    if (args.length == 0) {
        parser.printUsage(System.err);
        return;
    }
    parser.parseArgument(args);
    IHyracksClientConnection hcc = new HyracksConnection(options.host, options.port);
    JobSpecification job = createJob(parseFileSplits(options.inFileOrderSplits), parseFileSplits(options.outFileSplits), options.memBufferAlg, options.frameLimit, options.frameSize, options.topK, options.usingHeapSorter);
    long start = System.currentTimeMillis();
    JobId jobId = hcc.startJob(job, options.profile ? EnumSet.of(JobFlag.PROFILE_RUNTIME) : EnumSet.noneOf(JobFlag.class));
    hcc.waitForCompletion(jobId);
    long end = System.currentTimeMillis();
    System.err.println("finished in:" + (end - start) + "ms");
}
Also used : IHyracksClientConnection(org.apache.hyracks.api.client.IHyracksClientConnection) CmdLineParser(org.kohsuke.args4j.CmdLineParser) JobSpecification(org.apache.hyracks.api.job.JobSpecification) HyracksConnection(org.apache.hyracks.api.client.HyracksConnection) JobId(org.apache.hyracks.api.job.JobId)

Example 48 with JobId

use of org.apache.hyracks.api.job.JobId in project asterixdb by apache.

the class HyracksUtils method runJob.

public static void runJob(JobSpecification spec, String appName) throws Exception {
    spec.setFrameSize(FRAME_SIZE);
    JobId jobId = hcc.startJob(spec, EnumSet.of(JobFlag.PROFILE_RUNTIME));
    hcc.waitForCompletion(jobId);
}
Also used : JobId(org.apache.hyracks.api.job.JobId)

Example 49 with JobId

use of org.apache.hyracks.api.job.JobId in project asterixdb by apache.

the class HyracksUtils method runJob.

public static void runJob(JobSpecification spec, String appName) throws Exception {
    spec.setFrameSize(FRAME_SIZE);
    JobId jobId = hcc.startJob(spec, EnumSet.of(JobFlag.PROFILE_RUNTIME));
    hcc.waitForCompletion(jobId);
}
Also used : JobId(org.apache.hyracks.api.job.JobId)

Example 50 with JobId

use of org.apache.hyracks.api.job.JobId in project asterixdb by apache.

the class JobStatusAPIIntegrationTest method startJob.

protected JobId startJob() throws Exception {
    WaitingOperatorDescriptor.CONTINUE_RUNNING.setFalse();
    JobSpecification spec = new JobSpecification();
    WaitingOperatorDescriptor sourceOpDesc = new WaitingOperatorDescriptor(spec, 0, 0);
    PartitionConstraintHelper.addPartitionCountConstraint(spec, sourceOpDesc, 1);
    spec.addRoot(sourceOpDesc);
    JobId jId = executeTest(spec);
    // don't run for more than 100 s
    int maxLoops = 1000;
    while (maxLoops > 0 && !"RUNNING".equals(getJobStatus(jId))) {
        Thread.sleep(100);
        --maxLoops;
    }
    return jId;
}
Also used : JobSpecification(org.apache.hyracks.api.job.JobSpecification) JobId(org.apache.hyracks.api.job.JobId)

Aggregations

JobId (org.apache.hyracks.api.job.JobId)57 JobSpecification (org.apache.hyracks.api.job.JobSpecification)17 IHyracksClientConnection (org.apache.hyracks.api.client.IHyracksClientConnection)13 HyracksConnection (org.apache.hyracks.api.client.HyracksConnection)11 HyracksException (org.apache.hyracks.api.exceptions.HyracksException)10 CmdLineParser (org.kohsuke.args4j.CmdLineParser)9 Test (org.junit.Test)5 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 Map (java.util.Map)4 NodeControllerState (org.apache.hyracks.control.cc.NodeControllerState)4 INodeManager (org.apache.hyracks.control.cc.cluster.INodeManager)4 Joblet (org.apache.hyracks.control.nc.Joblet)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 HashMap (java.util.HashMap)3 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 RemoteException (java.rmi.RemoteException)2