Package org.lab41.dendrite.jobs

Examples of org.lab41.dendrite.jobs.BranchCommitSubsetJob


            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        MetaGraphTx tx = metaGraphService.newTransaction();

        GraphMetadata graphMetadata = tx.getGraph(graphId);
        if (graphMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing graph metadata '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        ProjectMetadata projectMetadata = graphMetadata.getProject();
        if (projectMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing project metadata for graph '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
View Full Code Here


            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        MetaGraphTx tx = metaGraphService.newTransaction();

        GraphMetadata graphMetadata = tx.getGraph(graphId);
        if (graphMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing graph metadata '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        ProjectMetadata projectMetadata = graphMetadata.getProject();
        if (projectMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing project metadata for graph '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
View Full Code Here

            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        MetaGraphTx tx = metaGraphService.newTransaction();

        GraphMetadata graphMetadata = tx.getGraph(graphId);
        if (graphMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing graph metadata '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        ProjectMetadata projectMetadata = graphMetadata.getProject();
        if (projectMetadata == null) {
            response.put("status", "error");
            response.put("msg", "missing project metadata for graph '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
View Full Code Here

    public GetJobResponse getJob(@PathVariable String jobId) throws NotFound {

        MetaGraphTx tx = metaGraphService.buildTransaction().readOnly().start();

        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            if (jobMetadata == null) {
                throw new NotFound(JobMetadata.class, jobId);
            }

            return new GetJobResponse(jobMetadata);
View Full Code Here

    public DeleteJobResponse deleteJob(@PathVariable String jobId) throws NotFound {
        MetaGraphTx tx = metaGraphService.newTransaction();
        DeleteJobResponse deleteJobResponse;

        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            if (jobMetadata == null) {
                throw new NotFound(JobMetadata.class, jobId);
            }

            tx.deleteJob(jobMetadata);
View Full Code Here

            response.put("msg", "missing project metadata for graph '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        JobMetadata jobMetadata = tx.createJob(projectMetadata);

        response.put("status", "ok");
        response.put("msg", "job submitted");
        response.put("jobId", jobMetadata.getId().toString());

        tx.commit();

        if (!algorithm.equals("approximate_diameter") &&
           !algorithm.equals("connected_component") &&
           !algorithm.equals("connected_component_stats") &&
           !algorithm.equals("directed_triangle_count") &&
           !algorithm.equals("eigen_vector_normalization") &&
           !algorithm.equals("graph_laplacian") &&
           !algorithm.equals("kcore") &&
           !algorithm.equals("pagerank") &&
           !algorithm.equals("partitioning") &&
           !algorithm.equals("simple_coloring") &&
           !algorithm.equals("simple_undirected_triangle_count") &&
           !algorithm.equals("sssp") &&
           !algorithm.equals("TSC") &&
           !algorithm.equals("undirected_triangle_count")) {
            response.put("status", "error");
            response.put("msg", algorithm + " not implemented");
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        // We can't pass the values directly because they'll live in a separate thread.
        graphLabService.graphLabAlgorithm(graph, algorithm, jobMetadata.getId());

        return new ResponseEntity<>(response, HttpStatus.OK);
    }
View Full Code Here

            response.put("msg", "missing project metadata for graph '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        JobMetadata jobMetadata = tx.createJob(projectMetadata);

        response.put("status", "ok");
        response.put("msg", "job submitted");
        response.put("jobId", jobMetadata.getId().toString());

        tx.commit();

        // We can't pass the values directly because they'll live in a separate thread.
        edgeDegreesService.titanCountDegrees(graph, jobMetadata.getId());

        return new ResponseEntity<>(response, HttpStatus.OK);
    }
View Full Code Here

            response.put("msg", "missing project metadata for graph '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        JobMetadata jobMetadata = tx.createJob(projectMetadata);

        response.put("status", "ok");
        response.put("msg", "job submitted");
        response.put("jobId", jobMetadata.getId().toString());

        tx.commit();

        // We can't pass the values directly because they'll live in a separate thread.
        edgeDegreesService.faunusCountDegrees(graph, jobMetadata.getId());

        return new ResponseEntity<>(response, HttpStatus.OK);
    }
View Full Code Here

            response.put("msg", "missing project metadata for graph '" + graphId + "'");
            tx.rollback();
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        JobMetadata jobMetadata = tx.createJob(projectMetadata);

        response.put("status", "ok");
        response.put("msg", "job submitted");
        response.put("jobId", jobMetadata.getId().toString());

        tx.commit();

        if (!algorithm.equals("centrality")) {
            response.put("status", "error");
            response.put("msg", algorithm + " not implemented");
            return new ResponseEntity<>(response, HttpStatus.NOT_FOUND);
        }

        // We can't pass the values directly because they'll live in a separate thread.
        snapService.snapAlgorithm(graph, algorithm, jobMetadata.getId());

        return new ResponseEntity<>(response, HttpStatus.OK);
    }
View Full Code Here

                if (jobMap.containsKey(hadoopJobId)) {
                    setJobState(jobMap.get(hadoopJobId), JobMetadata.DONE);
                } else {
                    MetaGraphTx tx = metaGraph.newTransaction();
                    JobMetadata jobMetadata = tx.getJob(jobId);
                    JobMetadata childJobMetadata = tx.createJob(jobMetadata);
                    childJobMetadata.setName("faunusHadoopJob");
                    childJobMetadata.setState(JobMetadata.DONE);
                    childJobMetadata.setProgress(1.0f);
                    childJobMetadata.setMapreduceJobId(hadoopJobId.toString());
                    tx.commit();

                    jobMap.put(hadoopJobId, childJobMetadata.getId());
                }
            }
        }

        for (Job hadoopJob: failedJobs) {
            JobID hadoopJobId = hadoopJob.getJobID();
            logger.debug("found failed hadoop job:", hadoopJobId.toString());

            if (jobMap.containsKey(hadoopJobId)) {
                setJobState(jobMap.get(hadoopJobId), JobMetadata.ERROR);
            } else {
                MetaGraphTx tx = metaGraph.newTransaction();
                JobMetadata jobMetadata = tx.getJob(jobId);
                JobMetadata childJobMetadata = tx.createJob(jobMetadata);
                childJobMetadata.setName("faunusHadoopJob");
                childJobMetadata.setMapreduceJobId(hadoopJobId.toString());
                childJobMetadata.setState(JobMetadata.ERROR);
                tx.commit();

                jobMap.put(hadoopJobId, childJobMetadata.getId());
            }
        }

        float totalProgress;

        // Don't divide by zero if we don't have any jobs in progress.
        if (jobsInProgress.isEmpty()) {
            totalProgress = 1;
        } else {
            totalProgress = ((float) successfulJobs.size()) / ((float) jobsInProgress.size());
        }

        Job hadoopRunningJob = jobControl.getRunningJob();
        if (hadoopRunningJob != null) {
            JobID hadoopJobId = hadoopRunningJob.getJobID();
            logger.debug("found active hadoop job:", hadoopJobId.toString());

            JobStatus status = hadoopRunningJob.getStatus();
            float progress = 0.25f * (
                    status.getSetupProgress() +
                            status.getMapProgress() +
                            status.getReduceProgress() +
                            status.getCleanupProgress());

            logger.debug("found progress: "
                    + status.getSetupProgress() + " "
                    + status.getMapProgress() + " "
                    + status.getReduceProgress() + " "
                    + status.getCleanupProgress() + " "
                    + progress);

            if (jobMap.containsKey(hadoopJobId)) {
                setJobProgress(jobMap.get(hadoopJobId), progress);
            } else {
                MetaGraphTx tx = metaGraph.newTransaction();
                JobMetadata jobMetadata = tx.getJob(jobId);
                JobMetadata childJobMetadata = tx.createJob(jobMetadata);
                childJobMetadata.setName("faunusHadoopJob");
                childJobMetadata.setProgress(progress);
                childJobMetadata.setState(JobMetadata.RUNNING);
                childJobMetadata.setMapreduceJobId(hadoopJobId.toString());
                tx.commit();

                jobMap.put(hadoopJobId, childJobMetadata.getId());
            }

            JobMetadata.Id jobMetadataId = jobMap.get(hadoopJobId);
            setJobProgress(jobMetadataId, progress);
            totalProgress += (progress / ((float) jobsInProgress.size()));
View Full Code Here

TOP

Related Classes of org.lab41.dendrite.jobs.BranchCommitSubsetJob

Copyright © 2018 www.massapicom. 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.