Examples of WorkResult


Examples of edu.brown.hstore.Hstoreservice.WorkResult

        }
       
        // We want to store this before sending back the acknowledgment so that the transaction can get
        // access to it right away
        PartitionExecutor executor = hstore_site.getPartitionExecutor(ts.getBasePartition());
        WorkResult result = request.getResult();
       
        if (result.getStatus() != Status.OK) {
            // TODO: Process error!
        } else {
            for (int i = 0, cnt = result.getDepIdCount(); i < cnt; i++) {
                int fragmentId = request.getFragmentId(i);
                int stmtCounter = request.getStmtCounter(i);
                int paramsHash = request.getParamHash(i);
               
                VoltTable vt = null;
                try {
                    this.fds.setBuffer(result.getDepData(i).asReadOnlyByteBuffer());
                    vt = this.fds.readObject(VoltTable.class);
                } catch (IOException ex) {
                    throw new RuntimeException(ex);
                }
       
View Full Code Here

Examples of edu.brown.hstore.Hstoreservice.WorkResult

            // Now if it's a remote transaction, we need to use the coordinator to send
            // them our result. Note that we want to send a single message per partition. Unlike
            // with the TransactionWorkRequests, we don't need to wait until all of the partitions
            // that are prefetching for this txn at our local HStoreSite to finish.
            if (is_remote) {
                WorkResult wr = this.buildWorkResult(ts, result, status, error);
                TransactionPrefetchResult.Builder builder = TransactionPrefetchResult.newBuilder()
                                                                .setTransactionId(ts.getTransactionId().longValue())
                                                                .setSourcePartition(this.partitionId)
                                                                .setResult(wr)
                                                                .setStatus(status)
                                                                .addAllFragmentId(fragment.getFragmentIdList())
                                                                .addAllStmtCounter(fragment.getStmtCounterList());
                for (int i = 0, cnt = fragment.getFragmentIdCount(); i < cnt; i++) {
                    builder.addParamHash(parameters[i].hashCode());
                }
                if (debug.val)
                    LOG.debug(String.format("%s - Sending back %s to partition %d [numResults=%s, status=%s]",
                              ts, wr.getClass().getSimpleName(), ts.getBasePartition(),
                              result.size(), status));
                hstore_coordinator.transactionPrefetchResult((RemoteTransaction)ts, builder.build());
            }
        }
        // -------------------------------
        // LOCAL TRANSACTION
        // -------------------------------
        else if (is_remote == false) {
            LocalTransaction local_ts = (LocalTransaction)ts;
           
            // If the transaction is local, store the result directly in the local TransactionState
            if (status == Status.OK) {
                if (trace.val)
                    LOG.trace(String.format("%s - Storing %d dependency results locally for successful work fragment",
                              ts, result.size()));
                assert(result.size() == outputDepIds.length);
                DependencyTracker otherTracker = this.hstore_site.getDependencyTracker(ts.getBasePartition());
                for (int i = 0; i < outputDepIds.length; i++) {
                    if (trace.val)
                        LOG.trace(String.format("%s - Storing DependencyId #%d [numRows=%d]\n%s",
                                  ts, outputDepIds[i], result.dependencies[i].getRowCount(),
                                  result.dependencies[i]));
                    try {
                        otherTracker.addResult(local_ts, this.partitionId, outputDepIds[i], result.dependencies[i]);
                    } catch (Throwable ex) {
//                        ex.printStackTrace();
                        String msg = String.format("Failed to stored Dependency #%d for %s [idx=%d, fragmentId=%d]",
                                                   outputDepIds[i], ts, i, fragmentIds[i]);
                        LOG.error(String.format("%s - WorkFragment:%d\nExpectedIds:%s\nOutputDepIds: %s\nResultDepIds: %s\n%s",
                                  msg, fragment.hashCode(),
                                  fragment.getOutputDepIdList(), Arrays.toString(outputDepIds),
                                  Arrays.toString(result.depIds), fragment));
                        throw new ServerFaultException(msg, ex);
                    }
                } // FOR
            } else {
                local_ts.setPendingError(error, true);
            }
        }
        // -------------------------------
        // REMOTE TRANSACTION
        // -------------------------------
        else {
            if (trace.val)
                LOG.trace(String.format("%s - Constructing WorkResult with %d bytes from partition %d to send " +
                          "back to initial partition %d [status=%s]",
                          ts, (result != null ? result.size() : null),
                          this.partitionId, ts.getBasePartition(), status));
           
            RpcCallback<WorkResult> callback = ((RemoteTransaction)ts).getWorkCallback();
            if (callback == null) {
                LOG.fatal("Unable to send FragmentResponseMessage for " + ts);
                LOG.fatal("Orignal WorkFragment:\n" + fragment);
                LOG.fatal(ts.toString());
                throw new ServerFaultException("No RPC callback to HStoreSite for " + ts, ts.getTransactionId());
            }
            WorkResult response = this.buildWorkResult((RemoteTransaction)ts, result, status, error);
            assert(response != null);
            callback.run(response);
        }
       
        // Check whether this is the last query that we're going to get
View Full Code Here

Examples of edu.brown.hstore.Hstoreservice.WorkResult

       
        int dep_id = 10001;
        DependencySet result = new DependencySet(new int[]{ dep_id }, new VoltTable[]{ vt });
       
        RemoteTransaction ts = new RemoteTransaction(hstore_site);
        WorkResult partitionResult = executor.buildWorkResult(ts, result, Status.OK, null);
        assertNotNull(partitionResult);
        assertEquals(result.size(), partitionResult.getDepDataCount());
       
        assertEquals(1, partitionResult.getDepDataCount());
        for (int i = 0; i < partitionResult.getDepDataCount(); i++) {
            assertEquals(dep_id, partitionResult.getDepId(i));
           
            ByteString bs = partitionResult.getDepData(i);
            assertFalse(bs.isEmpty());
            System.err.println("SIZE: " + StringUtil.md5sum(bs.asReadOnlyByteBuffer()));
           
            byte serialized[] = bs.toByteArray();
            VoltTable clone = FastDeserializer.deserialize(serialized, VoltTable.class);
View Full Code Here

Examples of org.gradle.api.tasks.WorkResult

    }

    public void testExecute(final int numFilesCompiled) {
        setUpMocksAndAttributes(testObj, TEST_GROOVY_CLASSPATH);
        context.checking(new Expectations(){{
            WorkResult result = context.mock(WorkResult.class);

            one(groovyCompilerMock).setSource(with(hasSameItems(testObj.getSource())));
            one(groovyCompilerMock).setDestinationDir(testObj.getDestinationDir());
            one(groovyCompilerMock).setClasspath(testObj.getClasspath());
            one(groovyCompilerMock).setSourceCompatibility(testObj.getSourceCompatibility());
View Full Code Here

Examples of org.gradle.api.tasks.WorkResult

    }

    public void testExecute(final int numFilesCompiled) {
        setUpMocksAndAttributes(compile);
        context.checking(new Expectations() {{
            WorkResult result = context.mock(WorkResult.class);

            one(compilerMock).setSource(with(hasSameItems(compile.getSource())));
            one(compilerMock).setClasspath(compile.getClasspath());
            one(compilerMock).setDestinationDir(compile.getDestinationDir());
            one(compilerMock).setDependencyCacheDir(compile.getDependencyCacheDir());
View Full Code Here

Examples of org.gradle.api.tasks.WorkResult

        javaCompiler.setDestinationDir(getDestinationDir());
        javaCompiler.setClasspath(getClasspath());
        javaCompiler.setDependencyCacheDir(getDependencyCacheDir());
        javaCompiler.setSourceCompatibility(getSourceCompatibility());
        javaCompiler.setTargetCompatibility(getTargetCompatibility());
        WorkResult result = javaCompiler.execute();
        setDidWork(result.getDidWork());
    }
View Full Code Here

Examples of org.gradle.api.tasks.WorkResult

        compiler.setDestinationDir(getDestinationDir());
        compiler.setClasspath(getClasspath());
        compiler.setSourceCompatibility(getSourceCompatibility());
        compiler.setTargetCompatibility(getTargetCompatibility());
        compiler.setGroovyClasspath(taskClasspath);
        WorkResult result = compiler.execute();
        setDidWork(result.getDidWork());
    }
View Full Code Here

Examples of org.gradle.api.tasks.WorkResult

        if (!javaSource.isEmpty()) {
            javaCompiler.setSource(javaSource);
            javaCompiler.execute();
        }

        return new WorkResult() {
            public boolean getDidWork() {
                return true;
            }
        };
    }
View Full Code Here

Examples of org.gradle.api.tasks.WorkResult

    }

    public void testExecute(final int numFilesCompiled) {
        setUpMocksAndAttributes(testObj, false);
        context.checking(new Expectations(){{
            WorkResult result = context.mock(WorkResult.class);

            one(groovyCompilerMock).execute((GroovyJavaJointCompileSpec) with(IsNull.notNullValue()));
            will(returnValue(result));
            allowing(result).getDidWork();
            will(returnValue(numFilesCompiled > 0));
View Full Code Here

Examples of org.gradle.api.tasks.WorkResult

    @TaskAction
    protected void compile() {
        checkGroovyClasspathIsNonEmpty();
        DefaultGroovyJavaJointCompileSpec spec = createSpec();
        WorkResult result = getCompiler(spec).execute(spec);
        setDidWork(result.getDidWork());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.