Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
00d98d3b
Commit
00d98d3b
authored
11 years ago
by
Yiannis Georgiou
Committed by
Danny Auble
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add missing files
parent
7e2cdf00
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/slurm_acct_gather_filesystem.c
+200
-0
200 additions, 0 deletions
src/common/slurm_acct_gather_filesystem.c
src/common/slurm_acct_gather_filesystem.h
+98
-0
98 additions, 0 deletions
src/common/slurm_acct_gather_filesystem.h
with
298 additions
and
0 deletions
src/common/slurm_acct_gather_filesystem.c
0 → 100644
+
200
−
0
View file @
00d98d3b
/*****************************************************************************\
* slurm_acct_gather_filesystem.c - implementation-independent job filesystem
* accounting plugin definitions
*****************************************************************************
* Copyright (C) 2013 Bull.
* Written by Yiannis Georgiou <yiannis.georgiou@bull.net>
*
* This file is part of SLURM, a resource management program.
* For details, see <http://www.schedmd.com/slurmdocs/>.
* Please also read the included file: DISCLAIMER.
*
* 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.
\*****************************************************************************/
#include
<pthread.h>
#include
<stdlib.h>
#include
<string.h>
#include
"src/common/macros.h"
#include
"src/common/plugin.h"
#include
"src/common/plugrack.h"
#include
"src/common/slurm_protocol_api.h"
#include
"src/common/xmalloc.h"
#include
"src/common/xstring.h"
#include
"src/common/slurm_acct_gather_filesystem.h"
#include
"src/slurmd/slurmstepd/slurmstepd_job.h"
typedef
struct
slurm_acct_gather_filesystem_ops
{
int
(
*
node_update
)
(
void
);
void
(
*
conf_options
)
(
s_p_options_t
**
full_options
,
int
*
full_options_cnt
);
void
(
*
conf_set
)
(
s_p_hashtbl_t
*
tbl
);
}
slurm_acct_gather_filesystem_ops_t
;
/*
* These strings must be kept in the same order as the fields
* declared for slurm_acct_gather_filesystem_ops_t.
*/
static
const
char
*
syms
[]
=
{
"acct_gather_filesystem_p_node_update"
,
"acct_gather_filesystem_p_conf_options"
,
"acct_gather_filesystem_p_conf_set"
,
};
static
slurm_acct_gather_filesystem_ops_t
ops
;
static
plugin_context_t
*
g_context
=
NULL
;
static
pthread_mutex_t
g_context_lock
=
PTHREAD_MUTEX_INITIALIZER
;
static
bool
init_run
=
false
;
static
bool
acct_shutdown
=
true
;
static
int
freq
=
0
;
static
bool
plugin_polling
=
true
;
static
void
*
_watch_node
(
void
*
arg
)
{
int
type
=
PROFILE_FILESYSTEM
;
while
(
!
acct_shutdown
&&
acct_gather_profile_running
)
{
/* Do this until shutdown is requested */
(
*
(
ops
.
node_update
))();
slurm_mutex_lock
(
&
acct_gather_profile_timer
[
type
].
notify_mutex
);
pthread_cond_wait
(
&
acct_gather_profile_timer
[
type
].
notify
,
&
acct_gather_profile_timer
[
type
].
notify_mutex
);
slurm_mutex_unlock
(
&
acct_gather_profile_timer
[
type
].
notify_mutex
);
}
return
NULL
;
}
extern
int
acct_gather_filesystem_init
(
void
)
{
int
retval
=
SLURM_SUCCESS
;
char
*
plugin_type
=
"acct_gather_filesystem"
;
char
*
type
=
NULL
;
if
(
init_run
&&
g_context
)
return
retval
;
slurm_mutex_lock
(
&
g_context_lock
);
if
(
g_context
)
goto
done
;
type
=
slurm_get_acct_gather_filesystem_type
();
g_context
=
plugin_context_create
(
plugin_type
,
type
,
(
void
**
)
&
ops
,
syms
,
sizeof
(
syms
));
if
(
!
g_context
)
{
error
(
"cannot create %s context for %s"
,
plugin_type
,
type
);
retval
=
SLURM_ERROR
;
goto
done
;
}
init_run
=
true
;
done:
slurm_mutex_unlock
(
&
g_context_lock
);
xfree
(
type
);
if
(
retval
==
SLURM_SUCCESS
)
retval
=
acct_gather_conf_init
();
return
retval
;
}
extern
int
acct_gather_filesystem_fini
(
void
)
{
int
rc
;
if
(
!
g_context
)
return
SLURM_SUCCESS
;
init_run
=
false
;
rc
=
plugin_context_destroy
(
g_context
);
g_context
=
NULL
;
return
rc
;
}
extern
int
acct_gather_filesystem_startpoll
(
uint32_t
frequency
)
{
int
retval
=
SLURM_SUCCESS
;
pthread_attr_t
attr
;
pthread_t
_watch_node_thread_id
;
if
(
!
plugin_polling
)
return
SLURM_SUCCESS
;
if
(
acct_gather_filesystem_init
()
<
0
)
return
SLURM_ERROR
;
if
(
!
acct_shutdown
)
{
error
(
"acct_gather_filesystem_startpoll: "
"poll already started!"
);
return
retval
;
}
acct_shutdown
=
false
;
freq
=
frequency
;
if
(
frequency
==
0
)
{
/* don't want dynamic monitoring? */
debug2
(
"acct_gather_filesystem dynamic logging disabled"
);
return
retval
;
}
/* create polling thread */
slurm_attr_init
(
&
attr
);
if
(
pthread_attr_setdetachstate
(
&
attr
,
PTHREAD_CREATE_DETACHED
))
error
(
"pthread_attr_setdetachstate error %m"
);
if
(
pthread_create
(
&
_watch_node_thread_id
,
&
attr
,
&
_watch_node
,
NULL
))
{
debug
(
"acct_gather_filesystem failed to create _watch_node "
"thread: %m"
);
frequency
=
0
;
}
else
debug3
(
"acct_gather_filesystem dynamic logging enabled"
);
slurm_attr_destroy
(
&
attr
);
return
retval
;
}
extern
void
acct_gather_filesystem_g_conf_options
(
s_p_options_t
**
full_options
,
int
*
full_options_cnt
)
{
if
(
acct_gather_filesystem_init
()
<
0
)
return
;
(
*
(
ops
.
conf_options
))(
full_options
,
full_options_cnt
);
}
extern
void
acct_gather_filesystem_g_conf_set
(
s_p_hashtbl_t
*
tbl
)
{
if
(
acct_gather_filesystem_init
()
<
0
)
return
;
(
*
(
ops
.
conf_set
))(
tbl
);
}
This diff is collapsed.
Click to expand it.
src/common/slurm_acct_gather_filesystem.h
0 → 100644
+
98
−
0
View file @
00d98d3b
/*****************************************************************************\
* slurm_acct_gather_filesystem.h - implementation-independent job filesystem
* accounting plugin definitions
*****************************************************************************
* Copyright (C) 2013 Bull
* Written by Yiannis Georgiou <yiannis.georgiou@bull.net>
*
* This file is part of SLURM, a resource management program.
* For details, see <http://www.schedmd.com/slurmdocs/>.
* Please also read the included file: DISCLAIMER.
*
* 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.
\*****************************************************************************/
#ifndef __SLURM_ACCT_GATHER_FILESYSTEM_H__
#define __SLURM_ACCT_GATHER_FILESYSTEM_H__
#if HAVE_CONFIG_H
# include "config.h"
# if HAVE_INTTYPES_H
# include <inttypes.h>
# else
# if HAVE_STDINT_H
# include <stdint.h>
# endif
# endif
/* HAVE_INTTYPES_H */
#else
/* !HAVE_CONFIG_H */
# include <inttypes.h>
#endif
/* HAVE_CONFIG_H */
#include
<sys/resource.h>
#include
<sys/types.h>
#include
<time.h>
#include
<unistd.h>
#include
"slurm/slurm.h"
#include
"slurm/slurmdb.h"
#include
"src/common/macros.h"
#include
"src/common/pack.h"
#include
"src/common/list.h"
#include
"src/common/xmalloc.h"
#include
"src/common/slurm_acct_gather.h"
typedef
struct
acct_filesystem_data
{
uint64_t
reads
;
uint64_t
writes
;
double
read_size
;
// currently in megabytes
double
write_size
;
// currently in megabytes
}
acct_filesystem_data_t
;
extern
int
acct_gather_filesystem_init
(
void
);
/* load the plugin */
extern
int
acct_gather_filesystem_fini
(
void
);
/* unload the plugin */
extern
int
acct_gather_filesystem_startpoll
(
uint32_t
);
extern
int
acct_gather_filesystem_g_node_update
(
void
);
/*
* Define plugin local conf for acct_gather.conf
*
* Parameters
* full_options -- pointer that will receive list of plugin local
* definitions
* full_options_cnt -- count of plugin local definitions
*/
extern
void
acct_gather_filesystem_g_conf_options
(
s_p_options_t
**
full_options
,
int
*
full_options_cnt
);
/*
* set plugin local conf from acct_gather.conf into its structure
*
* Parameters
* tbl - hash table of acct_gather.conf key-values.
*/
extern
void
acct_gather_filesystem_g_conf_set
(
s_p_hashtbl_t
*
tbl
);
#endif
/*__SLURM_ACCT_GATHER_FILESYSTEM_H__*/
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment