~ubuntu-branches/ubuntu/trusty/nordugrid-arc/trusty

« back to all changes in this revision

Viewing changes to src/hed/acc/EMIES/JobControllerPluginEMIES.cpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2013-11-29 13:39:10 UTC
  • mfrom: (3.1.16 sid)
  • Revision ID: package-import@ubuntu.com-20131129133910-sy6ayoavphc5hozs
Tags: 4.0.0-1
4.0.0 Release (Closes: #715131) (LP: #1049798)

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
    
56
56
    for (std::map<std::string, std::list<Job*> >::iterator it = groupedJobs.begin();
57
57
         it != groupedJobs.end(); ++it) {
 
58
      std::list<EMIESResponse*> responses;
58
59
      AutoPointer<EMIESClient> ac(((EMIESClients&)clients).acquire(it->first));
59
 
      ac->info(it->second, IDsProcessed, IDsNotProcessed);
60
 
      // TODO: Log warning: //logger.msg(WARNING, "Job information not found in the information system: %s", (*it)->JobID);
 
60
      ac->info(it->second, responses);
 
61
      
 
62
      for (std::list<Job*>::iterator itJ = it->second.begin();
 
63
           itJ != it->second.end(); ++itJ) {
 
64
        std::list<EMIESResponse*>::iterator itR = responses.begin();
 
65
        for (; itR != responses.end(); ++itR) {
 
66
          EMIESJobInfo *j = dynamic_cast<EMIESJobInfo*>(*itR);
 
67
          if (j) {
 
68
            if (EMIESJob::getIDFromJob(**itJ) == j->getActivityID()) {
 
69
              j->toJob(**itJ);
 
70
              delete *itR;
 
71
              break;
 
72
            }
 
73
          }
 
74
          // TODO: Handle ERROR.
 
75
          // TODO: Log warning: //logger.msg(WARNING, "Job information not found in the information system: %s", (*it)->JobID);
 
76
        }
 
77
        if (itR != responses.end()) {
 
78
          IDsProcessed.push_back((**itJ).JobID);
 
79
          responses.erase(itR);
 
80
        }
 
81
        else {
 
82
          IDsNotProcessed.push_back((**itJ).JobID);
 
83
        }
 
84
      }
 
85
      
 
86
      for (std::list<EMIESResponse*>::iterator itR = responses.begin();
 
87
           itR != responses.end(); ++itR) {
 
88
        delete *itR;
 
89
      }
 
90
      
61
91
      ((EMIESClients&)clients).release(ac.Release());
62
92
    }
63
93
  }
119
149
  }
120
150
 
121
151
  bool JobControllerPluginEMIES::ResumeJobs(const std::list<Job*>& jobs, std::list<std::string>& IDsProcessed, std::list<std::string>& IDsNotProcessed, bool isGrouped) const {
122
 
    for (std::list<Job*>::const_iterator it = jobs.begin(); it != jobs.end(); ++it) {
123
 
      logger.msg(INFO, "Resume of EMI ES jobs is not supported");
124
 
      IDsNotProcessed.push_back((*it)->JobID);
125
 
    }
126
 
    return false;
 
152
            MCCConfig cfg;
 
153
            usercfg.ApplyToConfig(cfg);
 
154
 
 
155
            bool ok = true;
 
156
            for (std::list<Job*>::const_iterator it = jobs.begin(); it != jobs.end(); ++it) {
 
157
              Job& job = **it;
 
158
              if (!job.RestartState) {
 
159
                logger.msg(INFO, "Job %s does not report a resumable state", job.JobID);
 
160
                ok = false;
 
161
                IDsNotProcessed.push_back(job.JobID);
 
162
                continue;
 
163
              }
 
164
              logger.msg(VERBOSE, "Resuming job: %s at state: %s (%s)", job.JobID, job.RestartState.GetGeneralState(), job.RestartState());
 
165
              EMIESJob ejob;
 
166
              ejob = job;
 
167
              AutoPointer<EMIESClient> ac(((EMIESClients&)clients).acquire(ejob.manager));
 
168
              if(!ac->restart(ejob)) {
 
169
                ok = false;
 
170
                IDsNotProcessed.push_back((*it)->JobID);
 
171
                ((EMIESClients&)clients).release(ac.Release());
 
172
                continue;
 
173
              }
 
174
 
 
175
              IDsProcessed.push_back((*it)->JobID);
 
176
              ((EMIESClients&)clients).release(ac.Release());
 
177
              logger.msg(VERBOSE, "Job resuming successful");
 
178
            }
 
179
            return ok;
127
180
  }
128
181
 
129
182
  bool JobControllerPluginEMIES::GetURLToJobResource(const Job& job, Job::ResourceType resource, URL& url) const {