Example #1
0
  /**
   * It loads the objects using their non singleton implementations.
   *
   * @param propFileName the name of the properties file that needs to be picked up from
   *     PEGASUS_HOME/etc directory.If it is null, then the default properties file should be picked
   *     up.
   */
  public void loadNonSingletonObjects(String propFileName) {
    // these should be invoked in non singleton
    // manner but is not.
    mLogger = LogManagerFactory.loadSingletonInstance();

    mLogMsg = new String();
    mPoolProvider = new String();
    mProps =
        PegasusProperties.getInstance(
            (propFileName == null)
                ?
                // load the default properties file
                edu.isi.pegasus.common.util.CommonProperties.PROPERTY_FILENAME
                :
                // load the file with this name from $PEGASUS_HOME/etc directory
                propFileName);

    // these should be invoked in non singleton
    // manner but is not.
    mUserOpts = UserOptions.getInstance();

    mWorkDir = mProps.getExecDirectory();
    mStorageDir = mProps.getStorageDirectory();
    mDeepStorageStructure = mProps.useDeepStorageDirectoryStructure();
  }
Example #2
0
 /**
  * It loads the objects that the pool providers need in a singleton manner, wherever possible. If
  * the class in not implemented in Singleton manner, the objects would be loaded normally.
  */
 protected void loadSingletonObjects() {
   mLogger = LogManagerFactory.loadSingletonInstance();
   mLogMsg = new String();
   mPoolProvider = new String();
   mProps = PegasusProperties.getInstance();
   mUserOpts = UserOptions.getInstance();
   mWorkDir = mProps.getExecDirectory();
   mStorageDir = mProps.getStorageDirectory();
   mDeepStorageStructure = mProps.useDeepStorageDirectoryStructure();
 }
Example #3
0
  /**
   * This determines the working directory on remote execution pool on the basis of whether an
   * absolute path is specified in the pegasus.dir.exec directory or a relative path. If the job
   * class happens to be a create directory job it does not append the name of the random directory
   * since the job is trying to create that random directory.
   *
   * @param siteID the name of the site where the job has to be executed.
   * @param path the relative path that needs to be appended to the workdir from the execution pool.
   * @param jobClass the class of the job.
   * @return the path to the pool work dir.
   * @throws RuntimeException in case of site not found in the site catalog.
   */
  public String getExecPoolWorkDir(String siteID, String path, int jobClass) {
    SiteInfo execPool = this.getPoolEntry(siteID, "vanilla");
    if (execPool == null) {
      throw new RuntimeException("Entry for " + siteID + " does not exist in the Site Catalog");
    }
    String execPoolDir = mWorkDir;

    if (jobClass == Job.CREATE_DIR_JOB) {
      // the create dir jobs always run in the
      // workdir specified in the site catalog
      return execPool.getExecMountPoint();
    }

    if (mWorkDir.length() == 0 || mWorkDir.charAt(0) != '/') {
      // means you have to append the
      // value specfied by pegasus.dir.exec
      File f = new File(execPool.getExecMountPoint(), mWorkDir);
      execPoolDir = f.getAbsolutePath();
    }

    // get the random directory name
    String randDir = mUserOpts.getRandomDirName();

    if (randDir != null) {
      // append the random dir name to the
      // work dir constructed till now
      File f = new File(execPoolDir, randDir);
      execPoolDir = f.getAbsolutePath();
    }

    // path takes precedence over random dir
    if (path != null) {
      // well i can do nesting conditional return but wont
      return (path.length() == 0 || path.charAt(0) != '/')
          ?
          // append the path
          new File(execPoolDir, path).getAbsolutePath()
          : // else absolute path specified
          path;
    }

    return execPoolDir;
  }