Skip to content
Snippets Groups Projects
Commit 758179a2 authored by Moe Jette's avatar Moe Jette
Browse files
parent e49826e0
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,7 @@ extern int slurm_hostlist_push(hostlist_t hl, const char *hosts); ...@@ -25,6 +25,7 @@ extern int slurm_hostlist_push(hostlist_t hl, const char *hosts);
extern int slurm_hostlist_push_host(hostlist_t hl, const char *host); extern int slurm_hostlist_push_host(hostlist_t hl, const char *host);
extern int slurm_hostlist_find(hostlist_t hl, const char *hostname); extern int slurm_hostlist_find(hostlist_t hl, const char *hostname);
extern size_t slurm_hostlist_ranged_string(hostlist_t hl, size_t n, char *buf); extern size_t slurm_hostlist_ranged_string(hostlist_t hl, size_t n, char *buf);
extern void slurm_hostlist_uniq(hostlist_t hl);
struct slurm { struct slurm {
node_info_msg_t *node_info_msg; node_info_msg_t *node_info_msg;
...@@ -804,6 +805,11 @@ slurm_hostlist_ranged_string(hostlist_t hl = NULL) ...@@ -804,6 +805,11 @@ slurm_hostlist_ranged_string(hostlist_t hl = NULL)
OUTPUT: OUTPUT:
RETVAL RETVAL
void
slurm_hostlist_uniq(hostlist_t hl = NULL)
CODE:
slurm_hostlist_uniq(hl);
void void
DESTROY(hl) DESTROY(hl)
hostlist_t hl=NULL; hostlist_t hl=NULL;
......
# Set database information
$db_name = "slurm_acct_db";
$db_job_table = "job_table";
# These are the options you should change for your own site.
#$db_host = "fargo";
#$db_port = "3306";
#$db_user = "some_user";
#$db_passwd = "some_password";
# Database connection line for the DBI
$db_conn_line = "DBI:mysql:database=${db_name};host=${db_host}";
# "1;" Required for file inclusion
1;
#! /usr/bin/perl -w
###############################################################################
#
# slurmdbd_direct - write directly into the slurmdbd.
#
# based off the index in
# http://www.clusterresources.com/products/mwm/docs/16.3.3workloadtrace.shtml
#
#
###############################################################################
# Copyright (C) 2009 Lawrence Livermore National Security.
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
# Written by Danny Auble <da@llnl.gov>
# CODE-OCEC-09-009. All rights reserved.
#
# This file is part of SLURM, a resource management program.
# For details, see <http://www.llnl.gov/linux/slurm/>.
#
# SLURM is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# In addition, as a special exception, the copyright holders give permission
# to link the code of portions of this program with the OpenSSL library under
# certain conditions as described in each individual source file, and
# distribute linked combinations including the two. You must obey the GNU
# General Public License in all respects for all of the code used other than
# OpenSSL. If you modify file(s) with this exception, you may extend this
# exception to your version of the file(s), but you are not obligated to do
# so. If you do not wish to do so, delete this exception statement from your
# version. If you delete this exception statement from all source files in
# the program, then also delete it here.
#
# SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with SLURM; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
###############################################################################
use strict;
use FindBin;
use Getopt::Long 2.24 qw(:config no_ignore_case require_order);
use lib "${FindBin::Bin}/../lib/perl";
use lib qw(/home/da/slurm/1.3/snowflake/lib/perl/5.8.8);
use autouse 'Pod::Usage' => qw(pod2usage);
use Slurm ':all';
use Switch;
use DBI;
BEGIN { require "config.slurmdb.pl"; }
our ($logLevel, $db_conn_line, $db_job_table, $db_user, $db_passwd);
my $set = 0;
my $sql = "INSERT INTO $db_job_table " .
"(jobid, associd, wckeyid, uid, gid, nodelist, " .
"cluster, account, partition, wckey, eligible, " .
"submit, start, name, track_steps, state, priority, " .
"req_cpus, alloc_cpus) VALUES ";
foreach my $line (<STDIN>) {
chomp $line;
# the below list is based off the index in
# http://www.clusterresources.com/products/mwm/docs/16.3.3workloadtrace.shtml
my ($hr_time,
$timestamp,
$type,
$id,
$event,
$req_nodes,
$req_tasks,
$user,
$group,
$wall_limit,
$state,
$class,
$sub_time,
$dispatch_time,
$start_time,
$end_time,
$network,
$arch,
$op,
$node_mem_comp,
$node_mem,
$node_disk_comp,
$node_disk,
$node_features,
$queue_time,
$alloc_tasks,
$tasks_per_node,
$qos,
$flags,
$account,
$executable,
$rm_ext,
$bypass_cnt,
$cpu_secs,
$partition,
$procs_per_task,
$mem_per_task,
$disk_per_task,
$swap_per_task,
$eligible_time,
$timeout,
$alloc_hostlist,
$rm_name,
$req_hostlist,
$resv,
$app_sim_data,
$desc,
$message,
$cost,
$history,
$util,
$estimate,
$comp_code,
$ext_mem,
$ext_cpu,
@extra) = split /\s+/, $line;
next if !$type;
next if $type ne "job";
next if $event eq "JOBMIGRATE";
my $uid = getpwnam($user);
my $gid = getgrnam($group);
$uid = -2 if !$uid;
$gid = -2 if !$gid;
my $alloc_hl = Slurm::Hostlist::create($alloc_hostlist);
if($alloc_hl) {
Slurm::Hostlist::uniq($alloc_hl);
$alloc_hl = Slurm::Hostlist::ranged_string($alloc_hl);
}
$sql .= ", " if $set;
$sql .= "($id, 0, 0, $uid, $gid, '$alloc_hl', )";
$set = 1;
}
exit 0 if !$set;
$sql .= " on duplicate key update nodelist=VALUES(nodelist), account=VALUES(account), partition=VALUES(partition), wckey=VALUES(wckey), start=VALUES(start), alloc_cpus=VALUES(alloc_cpus)";
print "$sql\n";
exit 0;
$db_user = (getpwuid($<))[0] if !$db_user;
my $dbhandle = DBI->connect($db_conn_line, $db_user, $db_passwd,
{AutoCommit => 1, RaiseError => 1});
$dbhandle->do($sql);
exit 0;
...@@ -608,7 +608,8 @@ extern int job_sizes_grouped_by_top_acct(int argc, char *argv[]) ...@@ -608,7 +608,8 @@ extern int job_sizes_grouped_by_top_acct(int argc, char *argv[])
memset(&assoc_cond, 0, sizeof(acct_association_cond_t)); memset(&assoc_cond, 0, sizeof(acct_association_cond_t));
assoc_cond.id_list = job_cond->associd_list; assoc_cond.id_list = job_cond->associd_list;
assoc_cond.cluster_list = job_cond->cluster_list; assoc_cond.cluster_list = job_cond->cluster_list;
assoc_cond.partition_list = job_cond->partition_list; /* don't limit associations to having the partition_list */
//assoc_cond.partition_list = job_cond->partition_list;
if(!job_cond->acct_list || !list_count(job_cond->acct_list)) { if(!job_cond->acct_list || !list_count(job_cond->acct_list)) {
job_cond->acct_list = list_create(NULL); job_cond->acct_list = list_create(NULL);
list_append(job_cond->acct_list, "root"); list_append(job_cond->acct_list, "root");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment