~ubuntu-branches/ubuntu/utopic/nordugrid-arc/utopic

« back to all changes in this revision

Viewing changes to src/hed/libs/compute/Job.cpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2014-05-01 20:51:02 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20140501205102-icy9t3348uxobyx7
Tags: 4.1.0-1
* 4.1.0 Release
* Call dh_autoreconf to support ppc64le (Closes: #744639)

Show diffs side-by-side

added added

removed removed

Lines of Context:
233
233
 
234
234
    ActivityOldID = j.ActivityOldID;
235
235
    LocalInputFiles = j.LocalInputFiles;
 
236
    DelegationID = j.DelegationID;
236
237
 
237
238
    return *this;
238
239
  }
377
378
      }
378
379
    }
379
380
 
 
381
    if (job["Associations"]["DelegationID"]) {
 
382
      DelegationID.clear();
 
383
      for (XMLNode n = job["Associations"]["DelegationID"]; n; ++n) {
 
384
        DelegationID.push_back((std::string)n);
 
385
      }
 
386
    }
 
387
 
380
388
    // Pick generic GLUE2 information
381
389
    SetFromXML(job);
382
390
 
515
523
    STRINGTOXML(SubmissionClientName)
516
524
    STRINGLISTTOXML(OtherMessages)
517
525
 
518
 
    if ((ActivityOldID.size() > 0 || LocalInputFiles.size() > 0) && !node["Associations"]) {
 
526
    if ((ActivityOldID.size() > 0 || LocalInputFiles.size() > 0 || DelegationID.size() > 0) &&
 
527
        !node["Associations"]) {
519
528
      node.NewChild("Associations");
520
529
    }
521
530
 
530
539
      lif.NewChild("Source") = it->first;
531
540
      lif.NewChild("CheckSum") = it->second;
532
541
    }
 
542
 
 
543
    for (std::list<std::string>::const_iterator it = DelegationID.begin();
 
544
         it != DelegationID.end(); it++) {
 
545
      node["Associations"].NewChild("DelegationID") = *it;
 
546
    }
533
547
  }
534
548
 
535
549
  void Job::SaveToStream(std::ostream& out, bool longlist) const {
536
550
    out << IString("Job: %s", JobID) << std::endl;
537
551
    if (!Name.empty())
538
552
      out << IString(" Name: %s", Name) << std::endl;
539
 
    if (!State().empty())
540
 
      out << IString(" State: %s (%s)", State.GetGeneralState(), State.GetSpecificState())
 
553
    out << IString(" State: %s", State.GetGeneralState())
 
554
              << std::endl;
 
555
    if (longlist && !State().empty()) {
 
556
      out << IString(" Specific state: %s", State.GetSpecificState())
541
557
                << std::endl;
 
558
    }
542
559
    if (State == JobState::QUEUING && WaitingPosition != -1) {
543
560
      out << IString(" Waiting Position: %d", WaitingPosition) << std::endl;
544
561
    }
633
650
      if (StageInDir) out << IString(" Stagein directory URL: %s", StageInDir.fullstr()) << std::endl;
634
651
      if (StageOutDir) out << IString(" Stageout directory URL: %s", StageOutDir.fullstr()) << std::endl;
635
652
      if (SessionDir) out << IString(" Session directory URL: %s", SessionDir.fullstr()) << std::endl;
 
653
      if (!DelegationID.empty()) {
 
654
        out << IString(" Delegation IDs:") << std::endl;
 
655
        for (std::list<std::string>::const_iterator it = DelegationID.begin();
 
656
             it != DelegationID.end(); ++it) {
 
657
          out << "  " << *it << std::endl;
 
658
        }
 
659
      }
636
660
    }
637
661
 
638
662
    out << std::endl;
699
723
      return false;
700
724
    }
701
725
 
 
726
    std::list<std::string> files;
 
727
    if (!ListFilesRecursive(uc, src, files)) {
 
728
      logger.msg(ERROR, "Unable to retrieve list of job files to download for job %s", JobID);
 
729
      return false;
 
730
    }
 
731
 
 
732
    if (files.empty()) {
 
733
      logger.msg(WARNING, "No files to retrieve for job %s", JobID);
 
734
      return true;
 
735
    }
 
736
 
702
737
    // We must make it sure it is directory and it exists 
703
738
    if (!DirCreate(dst.Path(), S_IRWXU, true)) {
704
739
      logger.msg(WARNING, "Failed to create directory %s! Skipping job.", dst.Path());
705
740
      return false;
706
741
    }
707
742
 
708
 
    std::list<std::string> files;
709
 
    if (!ListFilesRecursive(uc, src, files)) {
710
 
      logger.msg(ERROR, "Unable to retrieve list of job files to download for job %s", JobID);
711
 
      return false;
712
 
    }
713
 
 
714
743
    const std::string srcpath = src.Path() + (src.Path().empty() || *src.Path().rbegin() != '/' ? "/" : "");
715
744
    const std::string dstpath = dst.Path() + (dst.Path().empty() || *dst.Path().rbegin() != G_DIR_SEPARATOR ? G_DIR_SEPARATOR_S : "");
716
745