Exemplo n.º 1
0
static void print_lua_script_error (struct lua_script *script)
{
    const char *s = basename (script->path);
    const char *err = lua_tostring (script->L, -1);
    if (script->fail_on_error)
        slurm_error ("spank/lua: Fatal: %s", err);
    else
        slurm_info ("spank/lua: Disabling %s: %s", s, err);
}
Exemplo n.º 2
0
/* Display a message through Slurm SPANK system. */
int _display_msg(spank_t sp, char const *caller, char const *msg) {
    uid_t uid = getuid();
    gid_t gid = getgid();
    char hostname[1024];

    int ctx = spank_context();
    char *ctx_str[] = {"ERROR", "LOCAL", "REMOTE", "ALLOCATOR", "SLURMD", "JOB_SCRIPT"};

    hostname[1023] = '\0';
    gethostname(hostname, 1023);

    if (msg && msg[0]) {
        slurm_info("%s: %s, %s, %s (uid=%d, gid=%d): %s", myname, ctx_str[ctx], hostname, caller, uid, gid, msg);
    }
    else {
        slurm_info("%s: %s, %s, %s (uid=%d, gid=%d)", myname, ctx_str[ctx], hostname, caller, uid, gid);
    }

    return 0;
}
Exemplo n.º 3
0
static int l_spank_log_msg (lua_State *L)
{
    int level = luaL_checknumber (L, 1);
    const char *msg;

    msg = l_string_sanitized (L);
    if (!msg)
        return (0);

    if (level == -1) {
        slurm_error (msg);
        lua_pushnumber (L, -1);
        return (1);
    }

    if (level == 0)
        slurm_info (msg);
    else if (level == 1)
        slurm_verbose (msg);
    else if (level == 2)
        slurm_debug (msg);
    return (0);
}