Skip to content

Commit be50785

Browse files
authored
Merge pull request #79 from sandynomad/master
Slurm 23.X.X requires "slurm_init()" to be called . .
2 parents 9673e9c + 6f80bdc commit be50785

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

slurm_drmaa/drmaa.c

+12
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,27 @@
3030

3131
#include <slurm_drmaa/session.h>
3232
#include <slurm/slurm.h>
33+
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(23,0,0)
34+
#include <slurm_drmaa/util.h>
35+
#endif
3336

3437
static char slurmdrmaa_version[50] = "";
3538

3639
static fsd_drmaa_session_t *
3740
slurmdrmaa_new_session( fsd_drmaa_singletone_t *self, const char *contact )
3841
{
42+
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(23,0,0)
43+
slurmdrmaa_init();
44+
#endif
3945
return slurmdrmaa_session_new( contact );
4046
}
4147

4248
static fsd_template_t *
4349
slurmdrmaa_new_job_template( fsd_drmaa_singletone_t *self )
4450
{
51+
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(23,0,0)
52+
slurmdrmaa_init();
53+
#endif
4554
return drmaa_template_new();
4655
}
4756

@@ -61,6 +70,9 @@ slurmdrmaa_get_version( fsd_drmaa_singletone_t *self,
6170
static const char *
6271
slurmdrmaa_get_DRM_system( fsd_drmaa_singletone_t *self )
6372
{
73+
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(23,0,0)
74+
slurmdrmaa_init();
75+
#endif
6476
if(slurmdrmaa_version[0] == '\0') /*no locks as drmaa_get_drm_system is usually called only once */
6577
{
6678
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(20,11,0)

slurm_drmaa/util.c

+13
Original file line numberDiff line numberDiff line change
@@ -723,3 +723,16 @@ slurmdrmaa_set_cluster(const char * value)
723723

724724
fsd_log_return(( "" ));
725725
}
726+
727+
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(23,0,0)
728+
static int slurmdrmaa_has_inited = 0;
729+
730+
void
731+
slurmdrmaa_init(void)
732+
{
733+
if (slurmdrmaa_has_inited != 1) {
734+
slurm_init(NULL);
735+
slurmdrmaa_has_inited = 1;
736+
}
737+
}
738+
#endif

slurm_drmaa/util.h

+3
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,8 @@ void slurmdrmaa_parse_native(job_desc_msg_t *job_desc, const char * value);
3737
char * slurmdrmaa_set_job_id(job_id_spec_t *job_id_spec);
3838
char * slurmdrmaa_unset_job_id(job_id_spec_t *job_id_spec);
3939
void slurmdrmaa_set_cluster(const char * value);
40+
#if SLURM_VERSION_NUMBER >= SLURM_VERSION_NUM(23,0,0)
41+
void slurmdrmaa__init(void);
42+
#endif
4043

4144
#endif /* __SLURM_DRMAA__UTIL_H */

0 commit comments

Comments
 (0)