Exemple #1
0
void jd_dump (saga::job::description & jd)
{
  std::vector <std::string> attr = jd.list_attributes ();

  for ( int i = 0; i < attr.size (); i++ )
  {
    std::cout << "  " << attr[i] << "\t : ";

    if ( ! jd.attribute_is_vector (attr[i]) )
    {
      std::cout << jd.get_attribute (attr[i]);
    }
    else
    {
      std::vector <std::string> vals = jd.get_vector_attribute (attr[i]);

      for ( int j = 0; j < vals.size (); j++ )
      {
        std::cout << vals[j] << " ";
      }
    }

    std::cout << std::endl;
  }
}  
Exemple #2
0
// handle staging attributes
void 
omii_gridsam_job::initialize_staging (saga::job::description jd, 
    JobSubmission& submit)
{
    if (!jd.attribute_exists(saga::job::attributes::description_file_transfer))
        return;

    // get the staging specifications
    std::vector<std::string> specs (
        jd.get_vector_attribute(saga::job::attributes::description_file_transfer));

    std::vector<std::string>::iterator end = specs.end();
    for (std::vector<std::string>::iterator it = specs.begin(); it != end; ++it)
    {
        using namespace saga::adaptors;
        std::string left_url, right_url;
        saga::adaptors::file_transfer_operator mode;
        if (!parse_file_transfer_specification(*it, left_url, mode, right_url))
        {
            SAGA_ADAPTOR_THROW(
                "omii_gridsam_job::initialize_staging: "
                    "ill formatted file transfer specification: " + *it,
                saga::BadParameter);
        }

        switch (mode) {
        case copy_local_remote:
            submit.add_StageInStep(left_url, right_url, true);
            break;

        case append_local_remote:
            submit.add_StageInStep(left_url, right_url, false);
            break;

        case copy_remote_local:
            submit.add_StageOutStep(left_url, right_url, true);
            break;

        case append_remote_local:
            submit.add_StageOutStep(left_url, right_url, false);
            break;

        default:
            SAGA_ADAPTOR_THROW(
                "omii_gridsam_job::initialize_staging: "
                    "ill formatted file transfer mode: " + *it,
                saga::BadParameter);
        }
    }
}
Exemple #3
0
  //////////////////////////////////////////////////////////////////////
  // SAGA API functions
  void
    job_service_cpi_impl::sync_create_job (saga::job::job         & ret,
                                           saga::job::description   jd)
  {
    if (!jd.attribute_exists(sja::description_executable)
        || jd.get_attribute(sja::description_executable).empty()) {
      SAGA_ADAPTOR_THROW("Missing 'Executable' attribute in job description.",
                         saga::BadParameter);
    }

    if (jd.attribute_exists(sja::description_interactive)
	&& jd.get_attribute(sja::description_interactive) == sa::common_true) {
      SAGA_ADAPTOR_THROW("Interactive execution not implemented.",
                         saga::NotImplemented);
    }

    instance_data data(this);

    // create new job. state == saga::job::New
    saga::job::job job = saga::adaptors::job(data->rm_.get_url(),
                                             jd, proxy_->get_session());
    ret = job;
  }