Package org.lab41.dendrite.metagraph.models

Examples of org.lab41.dendrite.metagraph.models.JobMetadata$Id


            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

    MetaGraphService metaGraphService;

    protected void setJobName(JobMetadata.Id jobId, String name) {
        MetaGraphTx tx = metaGraphService.newTransaction();
        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            jobMetadata.setName(name);
            tx.commit();
        } catch (TitanException e) {
            logger.debug("exception", e);
            throw e;
        }
View Full Code Here

    }

    protected void setJobState(JobMetadata.Id jobId, String state, String msg) {
        MetaGraphTx tx = metaGraphService.newTransaction();
        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            jobMetadata.setState(state);
            jobMetadata.setMessage(msg);

            if (state.equals(JobMetadata.DONE)) {
                jobMetadata.setProgress(1.0f);
            }

            tx.commit();
        } catch (TitanException e) {
            logger.debug("exception", e);
View Full Code Here

    }

    protected void setJobProgress(JobMetadata.Id jobId, float progress) {
        MetaGraphTx tx = metaGraphService.newTransaction();
        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            jobMetadata.setProgress(progress);
            tx.commit();
        } catch (TitanException e) {
            logger.debug("exception", e);
            throw e;
        }
View Full Code Here

    }

    protected void setJobName(JobMetadata.Id jobId, String name) {
        MetaGraphTx tx = metaGraph.newTransaction();
        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            jobMetadata.setName(name);
            tx.commit();
        } catch (TitanException e) {
            logger.debug("exception", e);
            throw e;
        }
View Full Code Here

    }

    protected void setJobState(JobMetadata.Id jobId, String state, String msg) {
        MetaGraphTx tx = metaGraph.newTransaction();
        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            jobMetadata.setState(state);
            jobMetadata.setMessage(msg);

            if (state.equals(JobMetadata.DONE)) {
                jobMetadata.setProgress(1.0f);
            }

            tx.commit();
        } catch (TitanException e) {
            logger.debug("exception", e);
View Full Code Here

    }

    protected void setJobProgress(JobMetadata.Id jobId, float progress) {
        MetaGraphTx tx = metaGraph.newTransaction();
        try {
            JobMetadata jobMetadata = tx.getJob(jobId);
            jobMetadata.setProgress(progress);
            tx.commit();
        } catch (TitanException e) {
            logger.debug("exception", e);
            throw e;
        }
View Full Code Here

TOP

Related Classes of org.lab41.dendrite.metagraph.models.JobMetadata$Id

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.