Back to index

nordugrid-arc-nox  1.1.0~rc6
Classes | Typedefs | Enumerations | Functions | Variables
Paul Namespace Reference

Classes

class  InvalidMessageException
class  HTMLRequest
class  HTMLResponse
class  Configurator
class  Job
class  JobQueue
class  JobRequest
class  JobSchedMetaData
struct  ServiceAndJob
class  PaulService
class  PointPair
class  FileTransfer
class  SysInfo

Typedefs

typedef void(* view_func )(Configurator *self, HTMLRequest &request, HTMLResponse &response)
typedef std::map< std::string,
view_func
Controller

Enumerations

enum  SchedStatusLevel {
  NEW, STARTING, RUNNING, CANCELLED,
  FAILED, FINISHED, KILLED, KILLING,
  EXCEPTION, UNKNOWN
}
enum  ARexStatusLevel {
  ACCEPTING, ACCEPTED, PREPARING, PREPARED,
  SUBMITTING, EXECUTING, AREX_KILLING, EXECUTED,
  FINISHING, AREX_FAILED, HELD, AREX_UNKNOWN
}

Functions

std::string tail (std::string file_name, int line_n)
void write_pair (std::ofstream &f, std::string name, std::string &value)
bool cut (std::string &input, std::string &name, std::string &value)
static void Remove (const std::string &path)
std::string sched_status_to_string (SchedStatusLevel l)
SchedStatusLevel sched_status_from_string (const std::string &s)
static Arc::Pluginget_service (Arc::PluginArgument *arg)
static std::string save_filename (const std::string &in)

Variables

static std::map
< SchedStatusLevel,
std::string > 
str_map

Class Documentation

struct Paul::ServiceAndJob

Definition at line 135 of file paul.cpp.

Collaboration diagram for Paul::ServiceAndJob:
Class Members
string * job_id
PaulService * self

Typedef Documentation

typedef std::map<std::string, view_func> Paul::Controller

Definition at line 91 of file configurator.h.

typedef void(* Paul::view_func)(Configurator *self, HTMLRequest &request, HTMLResponse &response)

Definition at line 90 of file configurator.h.


Enumeration Type Documentation

Enumerator:
ACCEPTING 
ACCEPTED 
PREPARING 
PREPARED 
SUBMITTING 
EXECUTING 
AREX_KILLING 
EXECUTED 
FINISHING 
AREX_FAILED 
HELD 
AREX_UNKNOWN 

Definition at line 24 of file job_status.h.

Enumerator:
NEW 
STARTING 
RUNNING 
CANCELLED 
FAILED 
FINISHED 
KILLED 
KILLING 
EXCEPTION 
UNKNOWN 

Definition at line 11 of file job_status.h.


Function Documentation

bool Paul::cut ( std::string &  input,
std::string &  name,
std::string &  value 
)

Definition at line 142 of file job.cpp.

{
    int size = input.size();
    int i = input.find_first_of("=");
    if (i == std::string::npos) {
        return false;
    }
    name = input.substr(0, i);
    value = input.substr(i+1, size);
    return true;
}

Here is the caller graph for this function:

static Arc::Plugin* Paul::get_service ( Arc::PluginArgument arg) [static]

Definition at line 31 of file paul.cpp.

{
    Arc::ServicePluginArgument* srvarg =
            arg?dynamic_cast<Arc::ServicePluginArgument*>(arg):NULL;
    if(!srvarg) return NULL;
    return new PaulService((Arc::Config*)(*srvarg));
}
static void Paul::Remove ( const std::string &  path) [static]

Definition at line 218 of file job.cpp.

{
    if (Glib::file_test(path, Glib::FILE_TEST_IS_REGULAR)) {
        unlink(path.c_str());
        return;
    }
    if (Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) {
        Glib::Dir dir(path);
        std::string d;
        while ((d = dir.read_name()) != "") {
            Remove(Glib::build_filename(path, d));
        }
        dir.close();
        rmdir(path.c_str());
    }
}

Here is the caller graph for this function:

static std::string Paul::save_filename ( const std::string &  in) [static]

Definition at line 22 of file run.cpp.

{
    std::string out = "";
    for (int i = 0; i < in.size(); i++) {
        out += in[i];
        if ((in[i] == '\\' && i < in.size() - 1 && in[i+1] != '\\') 
            || (in[i] == '\\' && i > 0 && in[i-1] != '\\')) {
            out += in[i];
        }
    }
    return out;
}

Here is the caller graph for this function:

Definition at line 35 of file job_status.cpp.

{
    if (s == "NEW") { 
        return NEW;
    } else if (s == "STARTING") {
        return STARTING;
    } else if (s == "RUNNING") {
        return RUNNING;
    } else if (s == "CANCELLED") {
        return CANCELLED;
    } else if (s == "FAILED") { 
        return FAILED;
    } else if (s == "FINISHED") {
        return FINISHED;
    } else if (s == "KILLED") {
        return KILLED;
    } else if (s == "KILLING")  {
        return KILLING;
    }

    return UNKNOWN;
}

Here is the caller graph for this function:

std::string Paul::sched_status_to_string ( SchedStatusLevel  l)

Definition at line 12 of file job_status.cpp.

{
    if (l == NEW) {
        return "NEW";
    } else if (l == STARTING) {
        return "STARTING";
    } else if (l == RUNNING) {
        return "RUNNING";
    } else if (l == CANCELLED) {
        return "CANCELLED";
    } else if (l == FAILED) {
        return "FAILED";
    } else if (l == FINISHED) {
        return "FINISHED";
    } else if (l == KILLED) {
        return "KILLED";
    } else if (l == KILLING) {
        return "KILLING";
    } 

    return "UNKNOWN";
}

Here is the caller graph for this function:

std::string Paul::tail ( std::string  file_name,
int  line_n 
)

Definition at line 244 of file configurator.cpp.

{
    std::ifstream fin(file_name.c_str(), std::ios::binary);
    int ln = 0;
    int seek_size = 1024;
    std::list<std::string> lines;
    fin.seekg(0, std::ios::end);
    int block_end = fin.tellg(); 
    if (block_end == -1) {
        return "";
    }
    fin.seekg(-seek_size, std::ios::end);
    int pos = fin.tellg();
    if (pos == -1) {
        return "";
    }
    int block_start = pos;

/*
    std::cout << "bs: " << block_start << std::endl;
    std::cout << "p: " << pos << std::endl;
    std::cout << "be: " << block_end << std::endl;
*/    
    std::vector<std::string> tokens;
    char buffer[1024];
    for(;;) { 
        memset(buffer, 0, sizeof(buffer));
        fin.read(buffer, sizeof(buffer));
        buffer[sizeof(buffer) - 1] = '\0';
        std::string l = buffer;
        tokens.clear();
        Arc::tokenize(l, tokens, "\n");
        for (int i = tokens.size()-1 ; i >= 0; i--) {
// std::cout << "**" << tokens[i] << "(" << i << "/" << tokens.size() << ")" << std::endl;
            if (i != 0) {
                lines.push_back(tokens[i] + "\n");
                ln++;
            } else {
                lines.push_back(tokens[i]);
            }
        }
        if (ln >= line_n) {
            break;
        }
        pos = fin.tellg();
// std::cout << pos << std::endl;
        if (pos == -1) {
            pos = block_end;
        }
        if ((fin.eof() && ln < line_n) || pos >= block_end) {
            if (block_start == 0) {
                break;
            }
            block_end = block_start;
            int s = block_start - seek_size;
            if (s < 0) {
                s = 0;
            }
            fin.seekg(s, std::ios::beg);
            block_start = fin.tellg();
            if (block_start == -1) {
                break; 
            }
        }
/*
    std::cout << "bs: " << block_start << std::endl;
    std::cout << "p: " << pos << std::endl;
    std::cout << "be: " << block_end << std::endl;
*/
    }
    fin.close();
    std::list<std::string>::iterator it;
    std::string out;
    std::string prev;
    for (it = lines.begin(); it != lines.end(); it++) {
        std::string l = *it;
        if (l[l.size() - 1] != '\n') {
            prev = l;
        } else {
            if (!prev.empty()) {
                l += prev;
                prev.clear();
            }
            out += ("<p class=\"log\">" + l + "</p>");
        }
    }
    return out;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void Paul::write_pair ( std::ofstream &  f,
std::string  name,
std::string &  value 
) [inline]

Definition at line 98 of file job.cpp.

{
    f << name << '=' << value << std::endl;
}

Here is the caller graph for this function:


Variable Documentation

std::map<SchedStatusLevel, std::string> Paul::str_map [static]

Definition at line 10 of file job_status.cpp.