Ignore:
Timestamp:
2017-01-29T21:51:30+13:00 (7 years ago)
Author:
davidb
Message:

Quick code added to downsample

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/hathitrust/wcsa/extracted-features-solr/trunk/solr-ingest/src/main/java/org/hathitrust/extractedfeatures/ProcessForCatalogLangCount.java

    r31364 r31365  
    4646    public void execCatalogLangCountSparkDirect()
    4747    {   
    48         String spark_app_name = generateSparkAppName("Spark-Direct + Per Volume");     
    49        
    50         SparkConf conf = new SparkConf().setAppName(spark_app_name);
     48        SparkConf conf = new SparkConf().setAppName("Spark-Direct + Per Volume: Downsample");
    5149        JavaSparkContext jsc = new JavaSparkContext(conf);
    5250       
     
    110108    }
    111109
     110    public void sampleDown()
     111    {
     112        String spark_app_name = generateSparkAppName("Spark Cluster + Per Volume");     
     113       
     114        SparkConf conf = new SparkConf().setAppName(spark_app_name);
     115        JavaSparkContext jsc = new JavaSparkContext(conf);
     116        jsc.hadoopConfiguration().set("io.compression.codec.bzip2.library", "java-builtin");
     117       
     118        String packed_sequence_path = "hdfs:///user/capitanu/data/packed-ef";
     119
     120        JavaPairRDD<Text, Text> input_pair_rdd = jsc.sequenceFile(packed_sequence_path, Text.class, Text.class);
     121
     122        JavaPairRDD<Text, Text> json_text_sample_rdd = input_pair_rdd.sample(false,0.0001,42);
     123       
     124        String output_directory = "packed-ef-10000";
     125        json_text_sample_rdd.saveAsTextFile(output_directory);
     126       
     127       
     128       
     129    }
    112130    public void execCatalogLangCount()
    113131    {   
    114        
    115        
     132           
    116133        String spark_app_name = generateSparkAppName("YARN Cluster + Per Volume");     
    117134       
     
    237254            = new ProcessForCatalogLangCount(input_dir,json_list_filename,verbosity);
    238255       
    239         prep_for_lang.execCatalogLangCount();
     256        //prep_for_lang.execCatalogLangCount();
     257        prep_for_lang.sampleDown();
    240258   
    241259    }
Note: See TracChangeset for help on using the changeset viewer.