Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
void
getJobStatusOp(getJobStatusResponse& getJobStatus_response, const string& job_id)
{
   GLITE_STACK_TRY("getJobStatus()");
   edglog_fn("wmpoperations::getJobStatus");

   initWMProxyOperation("getJobStatus");
   security::do_authZ("getJobStatusOp");

   // TODO status flag could be parametrized
   bool status_flag=true;
   // PERFORM Job actual Status request
   WMPEventLogger wmplogger(wmputilities::getEndpoint());
   JobStatus status = wmplogger.getStatus(status_flag);
   // fill in job Status structure:

   getJobStatus_response.jobStatus = new JobStatusStructType;
   getJobStatus_response.jobStatus->status = status.name();
   getJobStatus_response.jobStatus->jobid  = job_id;
   // TODO children?

   edglog(debug)<<"JobStatus retrieved successful"<<endl;
   GLITE_STACK_CATCH();
}