Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Public Attributes | Private Attributes | Static Private Attributes
Arc::JobDescription Class Reference

#include <JobDescription.h>

Collaboration diagram for Arc::JobDescription:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 JobDescription ()
 JobDescription (const long int &ptraddr)
 operator bool () const
bool Parse (const std::string &source)
bool Parse (const XMLNode &xmlSource)
std::string UnParse (const std::string &format="ARCJSDL") const
bool getSourceFormat (std::string &_sourceFormat) const
void Print (bool longlist=false) const
void AddHint (const std::string &key, const std::string &value)

Public Attributes

JobIdentificationType Identification
ApplicationType Application
ResourcesType Resources
DataStagingType DataStaging
JobMetaType JobMeta
std::map< std::string,
std::string > 
XRSL_elements
std::map< std::string,
std::string > 
JDL_elements

Private Attributes

std::string sourceFormat
std::map< std::string,
std::string > 
hints

Static Private Attributes

static Logger logger

Detailed Description

Definition at line 252 of file JobDescription.h.


Constructor & Destructor Documentation

Definition at line 254 of file JobDescription.h.

{};
JobDescription::JobDescription ( const long int &  ptraddr)

Definition at line 26 of file JobDescription.cpp.

{ *this = *((JobDescription*)ptraddr); }

Member Function Documentation

void JobDescription::AddHint ( const std::string &  key,
const std::string &  value 
)

Definition at line 395 of file JobDescription.cpp.

                                                                          {
    if(key.empty()) return;
    hints[key]=value;
  }

Here is the caller graph for this function:

bool JobDescription::getSourceFormat ( std::string &  _sourceFormat) const

Definition at line 384 of file JobDescription.cpp.

                                                                     {
    if (!*this) {
      logger.msg(VERBOSE, "There is no input defined yet or it's format can be determinized.");
      return false;
    }
    else {
      _sourceFormat = sourceFormat;
      return true;
    }
  }

Here is the call graph for this function:

Arc::JobDescription::operator bool ( void  ) const [inline]

Definition at line 259 of file JobDescription.h.

                          {
      return (!Application.Executable.Name.empty());
    }
bool JobDescription::Parse ( const std::string &  source)

Definition at line 301 of file JobDescription.cpp.

                                                    {
    if (source.empty()) {
      logger.msg(ERROR, "Empty job description source string");
      return false;
    }

    {
      logger.msg(VERBOSE, "Try to parse as XRSL");
      XRSLParser parser;
      parser.SetHints(hints);
      *this = parser.Parse(source);
      if (*this) {
        sourceFormat = "xrsl";
        return true;
      }
    }

    {
      logger.msg(VERBOSE, "Try to parse as JDL");
      JDLParser parser;
      parser.SetHints(hints);
      *this = parser.Parse(source);
      if (*this) {
        sourceFormat = "jdl";
        return true;
      }
    }

    {
      logger.msg(VERBOSE, "Try to parse as ARCJSDL");
      ARCJSDLParser parser;
      parser.SetHints(hints);
      *this = parser.Parse(source);
      if (*this) {
        sourceFormat = "arcjsdl";
        return true;
      }
    }

    logger.msg(ERROR, "The parsing of the job description was unsuccessful");
    return false;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

bool JobDescription::Parse ( const XMLNode xmlSource)

Definition at line 294 of file JobDescription.cpp.

  {
    std::string source;
    xmlSource.GetXML(source);
    return Parse(source);
  }

Here is the call graph for this function:

void JobDescription::Print ( bool  longlist = false) const

Definition at line 28 of file JobDescription.cpp.

                                                {

    STRPRINT(Application.Executable.Name, Executable);
    STRPRINT(Application.LogDir, Log Directory)
    STRPRINT(Identification.JobName, JobName)
    STRPRINT(Identification.Description, Description)
    STRPRINT(Identification.JobVOName, Virtual Organization)

    switch (Identification.JobType) {
    case SINGLE:
      std::cout << IString("Job type: single") << std::endl;
      break;
    case COLLECTIONELEMENT:
      std::cout << IString("Job type: collection") << std::endl;
      break;
    case PARALLELELEMENT:
      std::cout << IString("Job type: parallel") << std::endl;
      break;
    case WORKFLOWNODE:
      std::cout << IString("Job type: workflownode") << std::endl;
      break;
    }

    if (longlist) {
      if (!Identification.UserTag.empty()) {
        std::list<std::string>::const_iterator iter = Identification.UserTag.begin();
        for (; iter != Identification.UserTag.end(); iter++)
          std::cout << IString(" UserTag: %s", *iter) << std::endl;
      }

      if (!Identification.ActivityOldId.empty()) {
        std::list<std::string>::const_iterator iter = Identification.ActivityOldId.begin();
        for (; iter != Identification.ActivityOldId.end(); iter++)
          std::cout << IString(" Activity Old Id: %s", *iter) << std::endl;
      }

      STRPRINT(JobMeta.Author, Author)
      if (JobMeta.DocumentExpiration.GetTime() > 0)
        std::cout << IString(" DocumentExpiration: %s", JobMeta.DocumentExpiration.str()) << std::endl;

      if (!Application.Executable.Argument.empty()) {
        std::list<std::string>::const_iterator iter = Application.Executable.Argument.begin();
        for (; iter != Application.Executable.Argument.end(); iter++)
          std::cout << IString(" Argument: %s", *iter) << std::endl;
      }

      STRPRINT(Application.Input, Input)
      STRPRINT(Application.Output, Output)
      STRPRINT(Application.Error, Error)

      if (!Application.RemoteLogging.empty()) {
        std::list<URL>::const_iterator iter = Application.RemoteLogging.begin();
        for (; iter != Application.RemoteLogging.end(); iter++) {
          std::cout << IString(" RemoteLogging: %s", iter->fullstr()) << std::endl;
        }
      }

      if (!Application.Environment.empty()) {
        std::list< std::pair<std::string, std::string> >::const_iterator iter = Application.Environment.begin();
        for (; iter != Application.Environment.end(); iter++) {
          std::cout << IString(" Environment.name: %s", iter->first) << std::endl;
          std::cout << IString(" Environment: %s", iter->second) << std::endl;
        }
      }

      INTPRINT(Application.Rerun, Rerun)

      STRPRINT(Application.Prologue.Name, Prologue)
      if (!Application.Prologue.Argument.empty()) {
        std::list<std::string>::const_iterator iter = Application.Prologue.Argument.begin();
        for (; iter != Application.Prologue.Argument.end(); iter++)
          std::cout << IString(" Prologue.Arguments: %s", *iter) << std::endl;
      }

      STRPRINT(Application.Epilogue.Name, Epilogue)
      if (!Application.Epilogue.Argument.empty()) {
        std::list<std::string>::const_iterator iter = Application.Epilogue.Argument.begin();
        for (; iter != Application.Epilogue.Argument.end(); iter++)
          std::cout << IString(" Epilogue.Arguments: %s", *iter) << std::endl;
      }

      INTPRINT(Resources.SessionLifeTime.GetPeriod(), SessionLifeTime)

      if (bool(Application.AccessControl)) {
        std::string str;
        Application.AccessControl.GetXML(str, true);
        std::cout << IString(" AccessControl: %s", str) << std::endl;
      }

      if (Application.ProcessingStartTime.GetTime() > 0)
        std::cout << IString(" ProcessingStartTime: %s", Application.ProcessingStartTime.str()) << std::endl;

      if (Application.Notification.size() > 0) {
        std::cout << IString(" Notify:") << std::endl;
        for (std::list<NotificationType>::const_iterator it = Application.Notification.begin();
             it != Application.Notification.end(); it++) {
          for (std::list<std::string>::const_iterator it2 = it->States.begin();
               it2 != it->States.end(); it2++) {
            std::cout << " " << *it2;
          }
          std::cout << ":   " << it->Email << std::endl;
        }
      }

      if (!Application.CredentialService.empty()) {
        std::list<URL>::const_iterator iter = Application.CredentialService.begin();
        for (; iter != Application.CredentialService.end(); iter++)
          std::cout << IString(" CredentialService: %s", iter->str()) << std::endl;
      }

      if (Application.Join)
        std::cout << " Join: true" << std::endl;

      INTPRINT(Resources.TotalCPUTime.range.max, TotalCPUTime)
      INTPRINT(Resources.IndividualCPUTime.range.max, IndividualCPUTime)
      INTPRINT(Resources.TotalWallTime.range.max, TotalWallTime)
      INTPRINT(Resources.IndividualWallTime.range.max, IndividualWallTime)

      STRPRINT(Resources.NetworkInfo, NetworkInfo)

      if (!Resources.OperatingSystem.empty()) {
        std::cout << IString(" Operating system requirements:") << std::endl;
        std::list<Software>::const_iterator itOS = Resources.OperatingSystem.getSoftwareList().begin();
        std::list<Software::ComparisonOperator>::const_iterator itCO = Resources.OperatingSystem.getComparisonOperatorList().begin();
        for (; itOS != Resources.OperatingSystem.getSoftwareList().end(); itOS++, itCO++) {
          if (*itCO != &Software::operator==) std::cout << Software::toString(*itCO) << " ";
          std::cout << *itOS << std::endl;
        }
      }

      STRPRINT(Resources.Platform, Platform)
      INTPRINT(Resources.IndividualPhysicalMemory.max, IndividualPhysicalMemory)
      INTPRINT(Resources.IndividualVirtualMemory.max, IndividualVirtualMemory)
      INTPRINT(Resources.DiskSpaceRequirement.DiskSpace.max, DiskSpace)
      INTPRINT(Resources.DiskSpaceRequirement.CacheDiskSpace, CacheDiskSpace)
      INTPRINT(Resources.DiskSpaceRequirement.SessionDiskSpace, SessionDiskSpace)

      for (std::list<ResourceTargetType>::const_iterator it = Resources.CandidateTarget.begin();
           it != Resources.CandidateTarget.end(); it++) {
        if (it->EndPointURL)
          std::cout << IString(" EndPointURL: %s", it->EndPointURL.str()) << std::endl;
        if (!it->QueueName.empty())
          std::cout << IString(" QueueName: %s", it->QueueName) << std::endl;
      }

      if (!Resources.CEType.empty()) {
        std::cout << IString(" Computing endpoint requirements:") << std::endl;
        std::list<Software>::const_iterator itCE = Resources.CEType.getSoftwareList().begin();
        std::list<Software::ComparisonOperator>::const_iterator itCO = Resources.CEType.getComparisonOperatorList().begin();
        for (; itCE != Resources.CEType.getSoftwareList().end(); itCE++, itCO++) {
          if (*itCO != &Software::operator==) std::cout << Software::toString(*itCO) << " ";
          std::cout << *itCE << std::endl;
        }
      }

      switch (Resources.NodeAccess) {
      case NAT_INBOUND:
        std::cout << IString(" NodeAccess: Inbound") << std::endl;
        break;
      case NAT_OUTBOUND:
        std::cout << IString(" NodeAccess: Outbound") << std::endl;
        break;
      case NAT_INOUTBOUND:
        std::cout << IString(" NodeAccess: Inbound and Outbound") << std::endl;
        break;
      }

      INTPRINT(Resources.SlotRequirement.NumberOfSlots.max, NumberOfSlots)
      INTPRINT(Resources.SlotRequirement.ProcessPerHost.max, ProcessPerHost)
      INTPRINT(Resources.SlotRequirement.ThreadsPerProcesses.max, ThreadsPerProcesses)
      STRPRINT(Resources.SlotRequirement.SPMDVariation, SPMDVariation)

      if (!Resources.RunTimeEnvironment.empty()) {
        std::cout << IString(" Run time environment requirements:") << std::endl;
        std::list<Software>::const_iterator itSW = Resources.RunTimeEnvironment.getSoftwareList().begin();
        std::list<Software::ComparisonOperator>::const_iterator itCO = Resources.RunTimeEnvironment.getComparisonOperatorList().begin();
        for (; itSW != Resources.RunTimeEnvironment.getSoftwareList().end(); itSW++, itCO++) {
          if (*itCO != &Software::operator==) std::cout << Software::toString(*itCO) << " ";
          std::cout << *itSW << std::endl;
        }
      }

      if (!DataStaging.File.empty()) {
        std::list<FileType>::const_iterator iter = DataStaging.File.begin();
        for (; iter != DataStaging.File.end(); iter++) {
          std::cout << IString(" File element:") << std::endl;
          std::cout << IString("     Name: %s", iter->Name) << std::endl;

          std::list<DataSourceType>::const_iterator itSource = iter->Source.begin();
          for (; itSource != iter->Source.end(); itSource++) {
            std::cout << IString("     Source.URI: %s", itSource->URI.fullstr()) << std::endl;
            INTPRINT(itSource->Threads, Source.Threads)
          }

          std::list<DataTargetType>::const_iterator itTarget = iter->Target.begin();
          for (; itTarget != iter->Target.end(); itTarget++) {
            std::cout << IString("     Target.URI: %s", itTarget->URI.fullstr()) << std::endl;
            INTPRINT(itTarget->Threads, Target.Threads)
            if (itTarget->Mandatory)
              std::cout << IString("     Target.Mandatory: true") << std::endl;
            INTPRINT(itTarget->NeededReplica, NeededReplica)
          }
          if (iter->KeepData)
            std::cout << IString("     KeepData: true") << std::endl;
          if (iter->IsExecutable)
            std::cout << IString("     IsExecutable: true") << std::endl;
          if (!iter->DataIndexingService.empty()) {
            std::list<URL>::const_iterator itDIS = iter->DataIndexingService.begin();
            for (; itDIS != iter->DataIndexingService.end(); itDIS++)
              std::cout << IString("     DataIndexingService: %s", itDIS->fullstr()) << std::endl;
          }
          if (iter->DownloadToCache)
            std::cout << IString("     DownloadToCache: true") << std::endl;
        }
      }

      if (!DataStaging.Directory.empty()) {
        std::list<DirectoryType>::const_iterator iter = DataStaging.Directory.begin();
        for (; iter != DataStaging.Directory.end(); iter++) {
          std::cout << IString(" Directory element:") << std::endl;
          std::cout << IString("     Name: %s", iter->Name) << std::endl;

          std::list<DataSourceType>::const_iterator itSource = iter->Source.begin();
          for (; itSource != iter->Source.end(); itSource++) {
            std::cout << IString("     Source.URI: %s", itSource->URI.fullstr()) << std::endl;
            INTPRINT(itSource->Threads, Source.Threads)
          }

          std::list<DataTargetType>::const_iterator itTarget = iter->Target.begin();
          for (; itTarget != iter->Target.end(); itTarget++) {
            std::cout << IString("     Target.URI: %s", itTarget->URI.fullstr()) << std::endl;
            INTPRINT(itTarget->Threads, Target.Threads)
            if (itTarget->Mandatory)
              std::cout << IString("     Target.Mandatory: true") << std::endl;
            INTPRINT(itTarget->NeededReplica, NeededReplica)
          }
          if (iter->KeepData)
            std::cout << IString("     KeepData: true") << std::endl;
          if (iter->IsExecutable)
            std::cout << IString("     IsExecutable: true") << std::endl;
          if (!iter->DataIndexingService.empty()) {
            std::list<URL>::const_iterator itDIS = iter->DataIndexingService.begin();
            for (; itDIS != iter->DataIndexingService.end(); itDIS++)
              std::cout << IString("     DataIndexingService: %s", itDIS->fullstr()) << std::endl;
          }
          if (iter->DownloadToCache)
            std::cout << IString("     DownloadToCache: true") << std::endl;
        }
      }
    }

    if (!XRSL_elements.empty()) {
      std::map<std::string, std::string>::const_iterator it;
      for (it = XRSL_elements.begin(); it != XRSL_elements.end(); it++)
        std::cout << IString(" XRSL_elements: [%s], %s", it->first, it->second) << std::endl;
    }

    if (!JDL_elements.empty()) {
      std::map<std::string, std::string>::const_iterator it;
      for (it = JDL_elements.begin(); it != JDL_elements.end(); it++)
        std::cout << IString(" JDL_elements: [%s], %s", it->first, it->second) << std::endl;
    }

    std::cout << std::endl;
  } // end of Print

Here is the call graph for this function:

Here is the caller graph for this function:

std::string JobDescription::UnParse ( const std::string &  format = "ARCJSDL") const

Definition at line 345 of file JobDescription.cpp.

                                                                 {
    std::string product;

    // Generate the output text with the right parser class
    if (!*this) {
      logger.msg(VERBOSE, "There is no successfully parsed source");
      return product;
    }

    if (lower(format) == "jdl") {
      logger.msg(VERBOSE, "Generate JDL output");
      JDLParser parser;
      parser.SetHints(hints);
      product = parser.UnParse(*this);
      if (product.empty())
        logger.msg(ERROR, "Generating %s output was unsuccessful", format);
    }
    else if (lower(format) == "xrsl") {
      logger.msg(VERBOSE, "Generate XRSL output");
      XRSLParser parser;
      parser.SetHints(hints);
      product = parser.UnParse(*this);
      if (product.empty())
        logger.msg(ERROR, "Generating %s output was unsuccessful", format);
    }
    else if (lower(format) == "arcjsdl") {
      logger.msg(VERBOSE, "Generate ARCJSDL output");
      ARCJSDLParser parser;
      parser.SetHints(hints);
      product = parser.UnParse(*this);
      if (product.empty())
        logger.msg(ERROR, "Generating %s output was unsuccessful", format);
    }
    else
      logger.msg(ERROR, "Unknown output format: %s", format);

    return product;
  }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 283 of file JobDescription.h.

Definition at line 285 of file JobDescription.h.

std::map<std::string,std::string> Arc::JobDescription::hints [private]

Definition at line 297 of file JobDescription.h.

Definition at line 282 of file JobDescription.h.

std::map<std::string, std::string> Arc::JobDescription::JDL_elements

Definition at line 290 of file JobDescription.h.

Definition at line 286 of file JobDescription.h.

Logger JobDescription::logger [static, private]

Definition at line 295 of file JobDescription.h.

Definition at line 284 of file JobDescription.h.

std::string Arc::JobDescription::sourceFormat [private]

Definition at line 293 of file JobDescription.h.

std::map<std::string, std::string> Arc::JobDescription::XRSL_elements

Definition at line 289 of file JobDescription.h.


The documentation for this class was generated from the following files: