<commit_before>/**
 * Copyright (c) 2012-2012 Malhar, Inc.
 * All rights reserved.
 */
package com.malhartech.stram.cli;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.jar.JarEntry;

import org.apache.commons.io.FileUtils;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.util.ConverterUtils;
import org.apache.log4j.lf5.util.StreamUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.malhartech.stram.StramClient;
import com.malhartech.stram.conf.ShipContainingJars;


/**
 * 
 * Launch a streaming application packaged as jar file<p>
 * <br>
 * Parses the jar file for
 * dependency pom and topology files. Dependency resolution is based on the
 * bundled pom.xml (if any) and the application is lauched with a modified
 * client classpath that includes application dependencies so that classes
 * defined in the topology can be loaded and {@link ShipContainingJars}
 * annotations processed. Caching is performed for dependency classpath
 * resolution.<br>
 * <br>
 */

public class StramAppLauncher {
  
  private static final Logger LOG = LoggerFactory.getLogger(StramAppLauncher.class);

  final File jarFile;
  private List<File> topologyList = new ArrayList<File>();
  private LinkedHashSet<URL> launchDependencies;
  
  public static class ProcessWatcher implements Runnable {

    private Process p;
    private volatile boolean finished = false;
    private volatile int rc;
    
    public ProcessWatcher(Process p) {
        this.p = p;
        new Thread(this).start();
    }

    public boolean isFinished() {
        return finished;
    }
<commit_msg>added comments<commit_after>/**
 * Copyright (c) 2012-2012 Malhar, Inc.
 * All rights reserved.
 */
package com.malhartech.stram.cli;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.jar.JarEntry;

import org.apache.commons.io.FileUtils;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.util.ConverterUtils;
import org.apache.log4j.lf5.util.StreamUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.malhartech.stram.StramClient;
import com.malhartech.stram.conf.ShipContainingJars;


/**
 * 
 * Launch a streaming application packaged as jar file<p>
 * <br>
 * Parses the jar file for
 * dependency pom and topology files. Dependency resolution is based on the
 * bundled pom.xml (if any) and the application is lauched with a modified
 * client classpath that includes application dependencies so that classes
 * defined in the topology can be loaded and {@link ShipContainingJars}
 * annotations processed. Caching is performed for dependency classpath
 * resolution.<br>
 * <br>
 */

public class StramAppLauncher {
  
  private static final Logger LOG = LoggerFactory.getLogger(StramAppLauncher.class);

  final File jarFile;
  private List<File> topologyList = new ArrayList<File>();
  private LinkedHashSet<URL> launchDependencies;
  
  /**
   * 
   * Starts a command and waits for it to complete<p>
   * <br>
   * 
   */
  public static class ProcessWatcher implements Runnable {

    private Process p;
    private volatile boolean finished = false;
    private volatile int rc;
    
    public ProcessWatcher(Process p) {
        this.p = p;
        new Thread(this).start();
    }

    public boolean isFinished() {
        return finished;
    }

{'fraction_non_alphanumeric': 0.09122373300370828, 'fraction_numerical': 0.005933250927070457, 'mean_word_length': 4.141041931385006, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1116126', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1181, 'n_words': 353}