Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Private Attributes
Paul::JobQueue Class Reference

#include <job_queue.h>

Collaboration diagram for Paul::JobQueue:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 JobQueue ()
virtual ~JobQueue ()
void setDB (const std::string &_db)
void addJob (Job &job)
void removeJob (Job &job)
void removeJob (const std::string &job_id)
bool checkJob (const std::string &job_id)
int size (void)
std::map< const std::string,
Job * > 
getAllJobs (void)
Joboperator[] (const std::string &job_id)
unsigned int getTotalJobs (void)
unsigned int getRunningJobs (void)
unsigned int getWaitingJobs (void)
unsigned int getStagingJobs (void)
unsigned int getLocalRunningJobs (void)

Private Attributes

std::map< std::string, Jobjobs
std::string db

Detailed Description

Definition at line 12 of file job_queue.h.


Constructor & Destructor Documentation

Definition at line 13 of file job_queue.cpp.

{
    // NOP
}
Paul::JobQueue::~JobQueue ( void  ) [virtual]

Definition at line 48 of file job_queue.cpp.

{
    // NOP
}

Member Function Documentation

void Paul::JobQueue::addJob ( Job job)

Definition at line 53 of file job_queue.cpp.

{
    // Insert job to the map
    jobs.insert(make_pair(job.getID(), job));
#if 0
    // create id file
    std::string fname = db + "/" + "/ids.sched";
    std::ofstream f(fname.c_str(), std::ios_base::app);
    f << job.getID() << std::endl;
    f.close();
#endif
    // save job
    // job.save();
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool Paul::JobQueue::checkJob ( const std::string &  job_id)

Definition at line 90 of file job_queue.cpp.

{
    std::cout << "jobs.size() is " << (int) jobs.size() << std::endl;
    if (jobs.find(job_id) == jobs.end()) {
        std::cout << std::endl << "This job is NOT IN the queue: " <<job_id.c_str() << std::endl;
        return false;
    } else {
        std::cout << std::endl << "This job is IN the queue: " <<job_id.c_str() << std::endl;
        return true;
    }
}
std::map< const std::string, Job * > Paul::JobQueue::getAllJobs ( void  )

Definition at line 118 of file job_queue.cpp.

{
    std::map<const std::string, Job *> job_list;
    std::map<std::string, Job>::iterator iter;
    for (iter = jobs.begin(); iter != jobs.end(); iter++ ) {
        const std::string &key = iter->first;
        Job *j = &(iter->second);
        job_list[key] = j;
    }
    return job_list;
}

Here is the caller graph for this function:

unsigned int Paul::JobQueue::getLocalRunningJobs ( void  ) [inline]

Definition at line 33 of file job_queue.h.

{ return 0; };
unsigned int Paul::JobQueue::getRunningJobs ( void  ) [inline]

Definition at line 30 of file job_queue.h.

{ return 0; };

Here is the caller graph for this function:

unsigned int Paul::JobQueue::getStagingJobs ( void  ) [inline]

Definition at line 32 of file job_queue.h.

{ return 0; };

Here is the caller graph for this function:

unsigned int Paul::JobQueue::getTotalJobs ( void  ) [inline]

Definition at line 29 of file job_queue.h.

{ return 0; };

Here is the caller graph for this function:

unsigned int Paul::JobQueue::getWaitingJobs ( void  ) [inline]

Definition at line 31 of file job_queue.h.

{ return 0; };

Here is the caller graph for this function:

Job & Paul::JobQueue::operator[] ( const std::string &  job_id)

Definition at line 130 of file job_queue.cpp.

{
    // lets the runtime environment to make excpetion 
    // if the job_id does not exsists
    return jobs[job_id];
}
void Paul::JobQueue::removeJob ( Job job)

Definition at line 68 of file job_queue.cpp.

{
    std::string s = job.getID();
    removeJob(s);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Paul::JobQueue::removeJob ( const std::string &  job_id)

Definition at line 74 of file job_queue.cpp.

{
    // jobs[job_id].remove();
    jobs.erase(job_id);
#if 0
    std::string fname = db + "/" + "/ids.sched";
    std::ofstream f(fname.c_str());

    std::map<std::string,Job>::iterator iter;
    for (iter = jobs.begin(); iter != jobs.end(); iter++) {
        f << (iter->second).getID() << std::endl;
    }
    f.close();
#endif
}
void Paul::JobQueue::setDB ( const std::string &  _db) [inline]

Definition at line 20 of file job_queue.h.

{ db = _db; };
int Paul::JobQueue::size ( void  ) [inline]

Definition at line 25 of file job_queue.h.

{ return jobs.size(); };

Member Data Documentation

std::string Paul::JobQueue::db [private]

Definition at line 15 of file job_queue.h.

std::map<std::string, Job> Paul::JobQueue::jobs [private]

Definition at line 14 of file job_queue.h.


The documentation for this class was generated from the following files: