Skip to content

Commit

Permalink
Merge branch 'master' into mx_mysql
Browse files Browse the repository at this point in the history
* master:
  mysql: Add column job_id_new to table mxq_job to link restarted job
  mxqsub: Improve assertions
  mxqsub: Fix minor memory leaks
  mxqsub: Add --restart option
  mxqsub: Let --verbose be more verbose
  mxq: Remove obsolete mxq.h
  mxqsub: Improve handling of mysql config defaults
  mxqsub: Cleanup missing includes and dependencies
  mxqsub: Remove build dependency to mxq_mysql
  • Loading branch information
mariux committed May 22, 2015
2 parents ffc0ecb + dc7499b commit cb30353
Show file tree
Hide file tree
Showing 13 changed files with 143 additions and 153 deletions.
24 changes: 10 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@ endif

##############################################################################

MXQ_MYSQL_DEFAULT_FILE = ${SYSCONFDIR}/mxq/mysql.cnf
MXQ_MYSQL_DEFAULT_FILE = ${SYSCONFDIR}/mxq/mysql.cnf
MXQ_MYSQL_DEFAULT_GROUP = mxqclient

MXQ_INITIAL_PATH = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin

CFLAGS_MXQ_MYSQL_DEFAULT_FILE = -DMXQ_MYSQL_DEFAULT_FILE=\"$(MXQ_MYSQL_DEFAULT_FILE)\"
CFLAGS_MXQ_INITIAL_PATH = -DMXQ_INITIAL_PATH=\"$(MXQ_INITIAL_PATH)\"
CFLAGS_MXQ_MYSQL_DEFAULT_FILE = -DMXQ_MYSQL_DEFAULT_FILE=\"$(MXQ_MYSQL_DEFAULT_FILE)\"
CFLAGS_MXQ_MYSQL_DEFAULT_GROUP = -DMXQ_MYSQL_DEFAULT_GROUP=\"$(MXQ_MYSQL_DEFAULT_GROUP)\"
CFLAGS_MXQ_INITIAL_PATH = -DMXQ_INITIAL_PATH=\"$(MXQ_INITIAL_PATH)\"

MYSQL_CONFIG = mysql_config

Expand Down Expand Up @@ -177,12 +180,6 @@ mx_flock.h += mx_flock.h
mx_mysql.h += mx_mysql.h
mx_mysql.h += $(mx_util.h)

### mxq.h --------------------------------------------------------------

mxq.h += mxq.h
mxq.h += $(mxq_group.h)
mxq.h += $(mxq_job.h)

### mxq_mysql.h --------------------------------------------------------

mxq_mysql.h += mxq_mysql.h
Expand All @@ -192,7 +189,6 @@ mxq_mysql.h += $(mxq_util.h)

mxq_util.h += mxq_util.h
mxq_util.h += $(mx_log.h)
mxq_util.h += $(mxq.h)

### mxq_group.h --------------------------------------------------------

Expand Down Expand Up @@ -314,7 +310,6 @@ clean: CLEAN += mxq_group.o

mxq_job.o: $(mx_util.h)
mxq_job.o: $(mx_log.h)
mxq_job.o: $(mxq.h)
mxq_job.o: $(mxq_job.h)
mxq_job.o: $(mxq_group.h)
mxq_job.o: $(mxq_mysql.h)
Expand Down Expand Up @@ -342,13 +337,15 @@ clean: CLEAN += mxqd.o
### mxqsub.o -------------------------------------------------------

mxqsub.o: $(mx_getopt.h)
mxqsub.o: $(mxq_util.h)
mxqsub.o: $(mx_util.h)
mxqsub.o: $(mx_log.h)
mxqsub.o: $(mxq_mysql.h)
mxqsub.o: $(mx_mysql.h)
mxqsub.o: $(mxq_group.h)
mxqsub.o: $(mxq_job.h)
mxqsub.o: $(mxq_util.h)
mxqsub.o: CFLAGS += $(CFLAGS_MYSQL)
mxqsub.o: CFLAGS += $(CFLAGS_MXQ_MYSQL_DEFAULT_FILE)
mxqsub.o: CFLAGS += $(CFLAGS_MXQ_MYSQL_DEFAULT_GROUP)

clean: CLEAN += mxqsub.o

Expand Down Expand Up @@ -377,7 +374,6 @@ install:: mxqd
### mxqsub ------------------------------------------------------------

mxqsub: mx_getopt.o
mxqsub: mxq_mysql.o
mxqsub: mxq_util.o
mxqsub: mx_util.o
mxqsub: mx_log.o
Expand Down
78 changes: 0 additions & 78 deletions mxq.h

This file was deleted.

1 change: 1 addition & 0 deletions mxq_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "mx_log.h"

#include "mxq_group.h"
#include "mxq_job.h"
#include "mxq_mysql.h"

#define MXQ_GROUP_FIELDS "group_id," \
Expand Down
1 change: 0 additions & 1 deletion mxq_job.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "mxq_group.h"
#include "mxq_job.h"
#include "mxq_mysql.h"
#include "mxq.h"

#define MXQ_JOB_FIELDS "job_id, " \
"job_status, " \
Expand Down
10 changes: 10 additions & 0 deletions mxq_job.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include <stdint.h>
#include <mysql.h>

#include <sys/time.h>
#include <sys/resource.h>

#include "mxq_group.h"

struct mxq_job {
Expand Down Expand Up @@ -74,6 +77,13 @@ struct mxq_job {
#define MXQ_JOB_STATUS_UNKNOWN 999
#define MXQ_JOB_STATUS_FINISHED 1000

#define MXQ_JOB_FLAGS_RESTART_ON_HOSTFAIL (1<<0)
#define MXQ_JOB_FLAGS_REQUEUE_ON_HOSTFAIL (1<<1)

#define MXQ_JOB_FLAGS_AUTORESTART (1<<62)
#define MXQ_JOB_FLAGS_HOSTFAIL (1<<63)


#define _to_string(s) #s
#define status_str(x) _to_string(x)

Expand Down
3 changes: 3 additions & 0 deletions mxq_job_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#include "mxq_util.h"
#include "mxq_mysql.h"

#include "mxq_group.h"
#include "mxq_job.h"


struct result {
struct mxq_job job;
Expand Down
8 changes: 0 additions & 8 deletions mxq_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@ void *realloc_forever(void *ptr, size_t size)
} while (1);
}

void mxq_free_job(struct mxq_job_full *job)
{
if (!job)
return;

free(job);
}

char **strvec_new(void)
{
char **strvec;
Expand Down
4 changes: 0 additions & 4 deletions mxq_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
#include <string.h>
#include <mysql.h>

#include "mxq.h"

char *mxq_hostname(void);

void mxq_free_job(struct mxq_job_full *job);

char **stringtostringvec(int argc, char *s);
char *stringvectostring(int argc, char *argv[]);
int chrcnt(char *s, char c);
Expand Down
1 change: 0 additions & 1 deletion mxqd.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "mx_util.h"
#include "mx_log.h"

#include "mxq.h"
#include "mxq_group.h"
#include "mxq_job.h"
#include "mxq_mysql.h"
Expand Down
2 changes: 2 additions & 0 deletions mxqdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "mxq_mysql.h"
#include "mx_getopt.h"

#include "mxq_group.h"

#ifndef MXQ_VERSION
#define MXQ_VERSION "0.00"
#endif
Expand Down
3 changes: 3 additions & 0 deletions mxqkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#include "mxq_mysql.h"
#include "mx_getopt.h"

#include "mxq_group.h"
#include "mxq_job.h"

#ifndef MXQ_VERSION
#define MXQ_VERSION "0.00"
#endif
Expand Down
Loading

0 comments on commit cb30353

Please sign in to comment.