reformat code and job array
This commit is contained in:
parent
a665ccd4fe
commit
9ff857db9f
64 changed files with 1497 additions and 2476 deletions
|
|
@ -9,27 +9,28 @@
|
|||
|
||||
extern int myapp_run(myconf_t*);
|
||||
|
||||
static char doc[] = "xce_controller";
|
||||
static char args_doc[] = "";
|
||||
const char* argp_program_version = MK_VERSION("xce v0.0.1-", STR(VERSION_COMMIT_ID));
|
||||
const char* argp_program_bug_address = BUG_EMAIL;
|
||||
static char doc[] = "xce_controller";
|
||||
static char args_doc[] = "";
|
||||
const char* argp_program_version
|
||||
= MK_VERSION("xce v0.0.1-", STR(VERSION_COMMIT_ID));
|
||||
const char* argp_program_bug_address = BUG_EMAIL;
|
||||
|
||||
struct arguments {
|
||||
char* myname;
|
||||
char* logfile;
|
||||
char* workdir;
|
||||
int verbose;
|
||||
};
|
||||
|
||||
static struct argp_option options[] = {
|
||||
{ "workdir", 'w', "DIR", 0, "The work directory of xce controller"},
|
||||
{ "workdir", 'w', "DIR", 0, "The work directory of xce controller" },
|
||||
{ "logfile", 'l', "FILE", 0, "The full path of log file" },
|
||||
{ "verbose", 'v', 0, 0, "Produce verbose logs" },
|
||||
{ "myname", 'n', "STR", 0, "The name of controller" },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static error_t parse_opt(int key,
|
||||
char* arg,
|
||||
struct argp_state* state)
|
||||
static error_t parse_opt(int key, char* arg, struct argp_state* state)
|
||||
{
|
||||
struct arguments* arguments = state->input;
|
||||
|
||||
|
|
@ -43,6 +44,9 @@ static error_t parse_opt(int key,
|
|||
case 'w':
|
||||
arguments->workdir = arg;
|
||||
break;
|
||||
case 'n':
|
||||
arguments->myname = arg;
|
||||
break;
|
||||
default:
|
||||
return ARGP_ERR_UNKNOWN;
|
||||
}
|
||||
|
|
@ -50,12 +54,7 @@ static error_t parse_opt(int key,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct argp argp = {
|
||||
options,
|
||||
parse_opt,
|
||||
args_doc,
|
||||
doc
|
||||
};
|
||||
static struct argp argp = { options, parse_opt, args_doc, doc };
|
||||
|
||||
static char* verbose_to_loglevel(int verbose)
|
||||
{
|
||||
|
|
@ -83,13 +82,14 @@ static char* verbose_to_loglevel(int verbose)
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
struct arguments arguments;
|
||||
myconf_t myconf;
|
||||
char* logfile = "/tmp/xce_controller.log";
|
||||
char* loglevel = "info";
|
||||
int logsize = 64 * 1024 * 1024;
|
||||
int logcount = 10;
|
||||
char conf_file[XCE_MAXPATH_LEN+1];
|
||||
struct arguments arguments;
|
||||
myconf_t myconf;
|
||||
char* logfile = "/tmp/xce_controller.log";
|
||||
char* loglevel = "info";
|
||||
int logsize = 64 * 1024 * 1024;
|
||||
int logcount = 10;
|
||||
char conf_file[XCE_MAXPATH_LEN + 1];
|
||||
char myname[XCE_MAXNAME_LEN + 1];
|
||||
|
||||
memset(&arguments, 0x0, sizeof(arguments));
|
||||
|
||||
|
|
@ -104,18 +104,27 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
mylog_init(logfile, loglevel, logsize, logcount);
|
||||
|
||||
|
||||
if (arguments.workdir == NULL) {
|
||||
INFO("no cluster work directory specified. The default work directory `"
|
||||
DEFAULT_WORKDIR
|
||||
"' will be used.");
|
||||
INFO("no cluster work directory specified. The default work directory "
|
||||
"`" DEFAULT_WORKDIR "' will be used.");
|
||||
arguments.workdir = DEFAULT_WORKDIR;
|
||||
}
|
||||
|
||||
|
||||
if (arguments.myname == NULL) {
|
||||
if (get_myname(myname, sizeof(myname) - 1) < 0) {
|
||||
ERROR("get_myname");
|
||||
return -1;
|
||||
}
|
||||
arguments.myname = myname;
|
||||
}
|
||||
|
||||
INFO("My name is %s", myname);
|
||||
|
||||
memset(&conf_file, 0x0, sizeof(conf_file));
|
||||
snprintf(conf_file, XCE_MAXPATH_LEN,
|
||||
"%s/conf/current_config", arguments.workdir);
|
||||
|
||||
snprintf(conf_file, XCE_MAXPATH_LEN, "%s/%s/conf/current_config",
|
||||
arguments.workdir, myname);
|
||||
|
||||
myconf.cluster_config = NULL;
|
||||
myconf.conffile = conf_file;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue