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 glite_lb_dump_stat_fields(void)
{
	JobStatus	s;
	attrs_t 	a = s.getAttrs(); 
	for (attrs_t::iterator i=a.begin(); i != a.end(); i++) {
		switch (i->second) {
			case JobStatus::INT_T:
			case JobStatus::STRING_T:
			case JobStatus::TIMEVAL_T:
				std::cerr << JobStatus::getAttrName(i->first) << ", ";
			default: break;
		}
	}
}