~ubuntu-branches/debian/sid/nordugrid-arc/sid

« back to all changes in this revision

Viewing changes to src/hed/acc/ARC0/JobControllerPluginARC0.cpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2012-12-13 16:41:31 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20121213164131-0fumka0jar8mxm07
Tags: 2.0.1-1
* 2.0.1 Release
* Drop patches accepted upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
 
62
62
    for (std::map<std::string, std::list<Job*> >::iterator hostit =
63
63
           jobsbyhost.begin(); hostit != jobsbyhost.end(); ++hostit) {
64
 
      URL infourl((*hostit->second.begin())->IDFromEndpoint);
 
64
             
 
65
      std::list<Job*> &jobsOnHost = hostit->second;
 
66
      while (!jobsOnHost.empty()) {
 
67
        logger.msg(DEBUG, "Jobs left to query: %d", jobsOnHost.size());
 
68
        // Move the first 1000 element of jobsOnHost into batch
 
69
        std::list<Job*> batch = std::list<Job*>();
 
70
        for (int i = 0; i < 1000; i++) {
 
71
          if (!jobsOnHost.empty()) {
 
72
            batch.push_back(jobsOnHost.front());
 
73
            jobsOnHost.pop_front();
 
74
          }
 
75
        }
 
76
        logger.msg(DEBUG, "Querying batch with %d jobs", batch.size());
 
77
      URL infourl(batch.front()->IDFromEndpoint);
65
78
 
66
79
      // merge filters
67
80
      std::string filter = "(|";
68
 
      for (std::list<Job*>::iterator it = hostit->second.begin();
69
 
           it != hostit->second.end(); ++it) {
 
81
      for (std::list<Job*>::iterator it = batch.begin(); it != batch.end(); ++it) {
70
82
        filter += URL((*it)->IDFromEndpoint).LDAPFilter();
71
83
      }
72
84
      filter += ")";
73
85
 
74
86
      infourl.ChangeLDAPFilter(filter);
75
87
 
 
88
      DataBuffer buffer;
76
89
      DataHandle handler(infourl, usercfg);
77
 
      DataBuffer buffer;
78
90
 
79
91
      if (!handler) {
80
92
        logger.msg(INFO, "Can't create information handle - is the ARC LDAP DMC plugin available?");
102
114
      XMLNodeList jobinfolist =
103
115
        xmlresult.Path("o/Mds-Vo-name/nordugrid-cluster-name/nordugrid-queue-name/nordugrid-info-group-name/nordugrid-job-globalid");
104
116
 
105
 
      for (std::list<Job*>::iterator jit = hostit->second.begin();
106
 
           jit != hostit->second.end(); ++jit) {
 
117
      for (std::list<Job*>::iterator jit = batch.begin();
 
118
           jit != batch.end(); ++jit) {
107
119
        XMLNodeList::iterator xit = jobinfolist.begin();
108
120
        for (; xit != jobinfolist.end(); ++xit) {
109
121
          if ((std::string)(*xit)["nordugrid-job-globalid"] == (*jit)->JobID.str()) {
206
218
 
207
219
        jobinfolist.erase(xit);
208
220
        IDsProcessed.push_back((*jit)->JobID);
 
221
        }   
209
222
      }
210
223
    }
211
224
  }
302
315
      }
303
316
  
304
317
      IDsProcessed.push_back(job.JobID);
 
318
      job.State = JobStateARC0("KILLED");
305
319
      logger.msg(VERBOSE, "Job cancelling successful");
306
320
    }
307
321