void printStatus(JobStatus &stat, int level) {
	std::vector<pair<JobStatus::Attr, JobStatus::AttrType> > attrList = stat.getAttrs();
        cout << "\nJob Status Information:\n - Current Status =  " << stat.name() << "\n   ---" << endl<< flush ;
	if (level>0)
	   for (unsigned i=0; i < attrList.size(); i++ ) {
		cout << stat.getAttrName(attrList[i].first) << " == " ;
		switch (attrList[i].second) {
			case JobStatus::INT_T     :
				cout << stat.getValInt(attrList[i].first) << endl<<flush;
				break;
			case JobStatus::STRING_T  :
				cout << stat.getValString(attrList[i].first) << endl<<flush;
				break;
			case JobStatus::TIMEVAL_T    :{
				timeval t = stat.getValTime(attrList[i].first);
				cout << t.tv_sec << "." << t.tv_usec << " s " << endl<<flush;}
				break;
			case JobStatus::BOOL_T    :
				cout << stat.getValBool(attrList[i].first) << endl<<flush;
				break;
			case JobStatus::JOBID_T    :{
				if(((glite::wmsutils::jobid::JobId)stat.getValJobId(attrList[i].first)).isSet())
				cout << stat.getValJobId(attrList[i].first).toString() << endl<<flush;
				}
		break;
			case JobStatus::STSLIST_T    :{
				std::vector<JobStatus> v = stat.getValJobStatusList(attrList[i].first);
				for(unsigned int i=0; i < v.size(); i++) ; //TBD
			}
			break ;
			case JobStatus::TAGLIST_T :{
				std::vector<std::pair<std::string,std::string> >  v = stat.getValTagList(  attrList[i].first ) ;
				for (unsigned int i = 0 ; i < v.size() ; i++ )
					cout << v[i].first  << " - " << v[i].second << " ;   " << flush ;
				}
			break;
			case JobStatus::INTLIST_T    :{
				std::vector<int> v = stat.getValIntList(attrList[i].first);
				for(unsigned int j=0; j < v.size(); j++)
					cout << "  " << v[j]  << flush ;
				cout << endl<<flush;
			}
			break;
			case JobStatus::STRLIST_T    :{
				std::vector<std::string> v = stat.getValStringList(attrList[i].first);
				for(unsigned int j=0; j < v.size(); j++)
					cout << v[j] ;
				cout << endl<<flush;
			}
			break ;
			default : /* something is wrong */
				break;
		}
	}
	cout << endl<<flush;
}
예제 #2
0
void
getSandboxBulkDestURI(getSandboxBulkDestURIResponse& getSandboxBulkDestURI_response,
                      const string& jid, const string& protocol)
{
   GLITE_STACK_TRY("getSandboxBulkDestURI()");
   edglog_fn("wmpoperations::getSandboxBulkDestURI");

   edglog(debug) << "getSandboxBulkDestURI requested for job: " << jid << endl;
   initWMProxyOperation("getSandboxBulkDestURI");
   security::do_authZ_jobid("getSandboxBulkDestURI", jid);
   // Initializing logger
   WMPEventLogger wmplogger(wmputilities::getEndpoint());
   wmplogger.setLBProxy(conf.isLBProxyAvailable(), wmputilities::getDN_SSL());
   JobId jobid(jid);
   wmplogger.setUserProxy(wmputilities::getJobDelegatedProxyPath(jobid));
   wmplogger.init_and_set_logging_job("", 0, &jobid);

   DestURIsStructType *destURIsStruct = new DestURIsStructType();
   destURIsStruct->Item = new vector<DestURIStructType*>(0);

   // Getting job status to get children number
   JobStatus status = wmplogger.getStatus(true);
   vector<string> jids = status.getValStringList(JobStatus::CHILDREN);
   edglog(debug)<<"Children count: "<<status.getValInt(JobStatus::CHILDREN_NUM)<<endl;
   vector<string>::iterator jidsiterator = jids.begin();
   jids.insert(jidsiterator, 1, jid);

   vector<string>::iterator iter = jids.begin();
   vector<string>::iterator const end = jids.end();
   for (; iter != end; ++iter) {
      vector<string> *uris = getJobDirectoryURIsVector(conf.getProtocols(),
                             conf.getDefaultProtocol(), conf.getDefaultPort(), conf.getHTTPSPort(),
                             *iter, protocol, "input");

      DestURIStructType *destURIStruct = new DestURIStructType();
      destURIStruct->id = *iter;
      destURIStruct->destURIs = uris;
      destURIsStruct->Item->push_back(destURIStruct);
   }
   getSandboxBulkDestURI_response.destURIsStruct = destURIsStruct;

   GLITE_STACK_CATCH();
}