Package com.ikanow.infinit.e.data_model.store.custom.mapreduce

Examples of com.ikanow.infinit.e.data_model.store.custom.mapreduce.CustomMapReduceJobPojo


    {
      //find admin entry);
      DBObject dbo = DbManager.getCustom().getLookup().findOne(new BasicDBObject(DbManager.or_,searchTerms.toArray()));     
      if ( dbo != null )
      {       
        CustomMapReduceJobPojo cmr = CustomMapReduceJobPojo.fromDb(dbo, CustomMapReduceJobPojo.class);
        //make sure user is allowed to see results
        if ( forced || RESTTools.adminLookup(userid) || cmr.submitterID.toString().equals(userid) )
        {
          //make sure job is not running
          if ( ( cmr.jobidS == null ) || cmr.jobidS.equals( "CHECKING_COMPLETION" ) || cmr.jobidS.equals( "" ) ) // (< robustness, sometimes server gets stuck here...)
          {
            // Remove index
            if (CustomOutputIndexingEngine.isIndexed(cmr)) {
              CustomOutputIndexingEngine.deleteOutput(cmr)
            }//TESTED (by hand)
           
            //remove results and job
            DbManager.getCustom().getLookup().remove(new BasicDBObject(CustomMapReduceJobPojo._id_, cmr._id));
            DbManager.getCollection(cmr.getOutputDatabase(), cmr.outputCollection).drop();
            DbManager.getCollection(cmr.getOutputDatabase(), cmr.outputCollectionTemp).drop();

            // Delete HDFS directory, if one is used
            if ((null != cmr.exportToHdfs) && cmr.exportToHdfs) {
              HadoopUtils.deleteHadoopDir(cmr);
            }
View Full Code Here


      jobQuery = new BasicDBObject(CustomMapReduceJobPojo._id_, oid);
    }
    catch (Exception e) {
      jobQuery = new BasicDBObject(CustomMapReduceJobPojo.jobtitle_, storedQueryNameOrId);     
    }
    CustomMapReduceJobPojo savedJob = CustomMapReduceJobPojo.fromDb(DbManager.getCustom().getLookup().findOne(jobQuery), CustomMapReduceJobPojo.class);
   
    if (null != savedJob) { // Is this even a saved job?
      if (null != savedJob.jarURL) {       
        savedJob = null;
      }
    }
    if (null != savedJob) { // Authorization
      boolean auth = false;
      String communityIdStrList = Arrays.toString(communityIdStrs);
      for (ObjectId commId: savedJob.communityIds) {
       
        if (communityIdStrList.contains(commId.toString())) {
          auth = true;
          break;
        }
      }
      if (!auth) {
        savedJob = null;
      }
      if (null == savedJob) {
        throw new RuntimeException("Can't find saved query, or is a custom job not a query, or authorization error");
      }
      // OK go get the results of the job
      DBCollection coll = DbManager.getCollection(savedJob.getOutputDatabase(), savedJob.outputCollection);
      BasicDBObject result = (BasicDBObject) coll.findOne(); // (at some point support multiple saved queries)
      if (null == result) {
        throw new RuntimeException("Saved query is empty");     
      }
      BasicDBObject apiResultToConvert = (BasicDBObject) result.get("value");
View Full Code Here

    }
   
    @Override
    public CustomMapReduceJobPojo deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException
    {
      CustomMapReduceJobPojo job = BaseApiPojo.getDefaultBuilder().create().fromJson(json, CustomMapReduceJobPojo.class);
      if (null != _allowedCommunityIds)
      {
        job.communityIds = new ArrayList<ObjectId>();       
        for (ObjectId communityId: _allowedCommunityIds)
        {
View Full Code Here

     
      // 1) Check authentication
     
      String jobName = null;
      ObjectId jobId = null;
      CustomMapReduceJobPojo customJob = null;
      BasicDBObject query = new BasicDBObject();
        // (already authenticated by this point)
     
      try {
        jobId = new ObjectId(jobNameOrShareId);
        query.put(CustomMapReduceJobPojo._id_, jobId);
        customJob = CustomMapReduceJobPojo.fromDb(
            MongoDbManager.getCustom().getLookup().findOne(query),
              CustomMapReduceJobPojo.class);
      }
      catch (Exception e) {
        // it's a job name
        jobName = jobNameOrShareId;
        query.put(CustomMapReduceJobPojo.jobtitle_, jobName);
        customJob = CustomMapReduceJobPojo.fromDb(
            MongoDbManager.getCustom().getLookup().findOne(query),
              CustomMapReduceJobPojo.class);
      }
      if (null == customJob) {
        throw new RuntimeException("Authentication failure or no matching custom job");
      }
      jobName = customJob.jobtitle;
      jobId = customJob._id;
     
      DBCollection cacheCollection = MongoDbManager.getCollection(customJob.getOutputDatabase(), customJob.outputCollection);
     
      // 2) Do we already have this cache?
     
      CustomCacheInJavascript cacheElement = _customCache.get(jobNameOrShareId);
     
View Full Code Here

TOP

Related Classes of com.ikanow.infinit.e.data_model.store.custom.mapreduce.CustomMapReduceJobPojo

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.