...
 
Commits (29)
...@@ -24,3 +24,4 @@ m4/install-sh ...@@ -24,3 +24,4 @@ m4/install-sh
m4/ltmain.sh m4/ltmain.sh
m4/missing m4/missing
src/config.h.in src/config.h.in
_output
include: 'https://xgitlab.cels.anl.gov/argo/argotest/raw/master/gitlab/basic.yml'
stages:
- build
- test
#make:generic:
#stage: build
#script:
#- ./autogen.sh
#- mkdir build
#- ./configure --prefix=`pwd`/build
#- make
#- make install
#artifacts:
#paths:
#- tests/*.log
#except:
#- /^wip.*/
#- /^WIP.*/
#
{ argotest ? (builtins.fetchGit {
url = https://xgitlab.cels.anl.gov/argo/argotest.git;
ref="master";
rev="2589756882a96dee624f4ed420510b720a85f2b0";
})
}:
(import argotest {
libnrm-src = ./.;
nrm-src = builtins.fetchGit {
url = https://xgitlab.cels.anl.gov/argo/nrm.git;
ref="downstream-refactor";
rev="37f5594287f77e42f3bf5f6b5a89f387c8905137";
};
})
File mode changed from 100644 to 100755
let argotest =
builtins.fetchTarball
"https://xgitlab.cels.anl.gov/argo/argotest/-/archive/master/argotest-master.tar.gz";
in import "${argotest}/test.nix" {
libnrm-override = ./.;
testName = "base";
}
...@@ -46,7 +46,8 @@ int nrm_init(struct nrm_context *ctxt, const char *uuid) ...@@ -46,7 +46,8 @@ int nrm_init(struct nrm_context *ctxt, const char *uuid)
ctxt->app_uuid = malloc(buff_size*sizeof(char)); ctxt->app_uuid = malloc(buff_size*sizeof(char));
strncpy(ctxt->app_uuid, uuid, buff_size); strncpy(ctxt->app_uuid, uuid, buff_size);
ctxt->context = zmq_ctx_new(); ctxt->context = zmq_ctx_new();
ctxt->socket = zmq_socket(ctxt->context, ZMQ_PUB); ctxt->socket = zmq_socket(ctxt->context, ZMQ_DEALER);
zmq_setsockopt(ctxt->socket, ZMQ_IDENTITY, ctxt->app_uuid, strnlen(uuid, 255));
int err = zmq_connect(ctxt->socket, uri); int err = zmq_connect(ctxt->socket, uri);
assert(err == 0); assert(err == 0);
char buf[512]; char buf[512];
...@@ -54,7 +55,7 @@ int nrm_init(struct nrm_context *ctxt, const char *uuid) ...@@ -54,7 +55,7 @@ int nrm_init(struct nrm_context *ctxt, const char *uuid)
sleep(1); sleep(1);
err = zmq_send(ctxt->socket, buf, strnlen(buf, 512), 0); err = zmq_send(ctxt->socket, buf, strnlen(buf, 512), 0);
assert(err > 0); assert(err > 0);
assert(!clock_gettime(CLOCK_REALTIME, &ctxt->time)); assert(!clock_gettime(CLOCK_MONOTONIC, &ctxt->time));
ctxt->acc = 0; ctxt->acc = 0;
return 0; return 0;
} }
...@@ -76,7 +77,7 @@ int nrm_send_progress(struct nrm_context *ctxt, unsigned long progress) ...@@ -76,7 +77,7 @@ int nrm_send_progress(struct nrm_context *ctxt, unsigned long progress)
{ {
char buf[512]; char buf[512];
struct timespec now; struct timespec now;
clock_gettime(CLOCK_REALTIME, &now); clock_gettime(CLOCK_MONOTONIC, &now);
long long int timediff = (now.tv_nsec - ctxt->time.tv_nsec) + long long int timediff = (now.tv_nsec - ctxt->time.tv_nsec) +
1e9* (now.tv_sec - ctxt->time.tv_sec); 1e9* (now.tv_sec - ctxt->time.tv_sec);
ctxt->acc += progress; ctxt->acc += progress;
...@@ -97,7 +98,7 @@ int nrm_send_phase_context(struct nrm_context *ctxt, unsigned int cpu, unsigned ...@@ -97,7 +98,7 @@ int nrm_send_phase_context(struct nrm_context *ctxt, unsigned int cpu, unsigned
{ {
char buf[512]; char buf[512];
struct timespec now; struct timespec now;
clock_gettime(CLOCK_REALTIME, &now); clock_gettime(CLOCK_MONOTONIC, &now);
long long int timediff = (now.tv_nsec - ctxt->time.tv_nsec) + long long int timediff = (now.tv_nsec - ctxt->time.tv_nsec) +
1e9* (now.tv_sec - ctxt->time.tv_sec); 1e9* (now.tv_sec - ctxt->time.tv_sec);
......
...@@ -28,13 +28,16 @@ struct nrm_context { ...@@ -28,13 +28,16 @@ struct nrm_context {
unsigned long acc; unsigned long acc;
}; };
#define NRM_DEFAULT_URI "ipc:///tmp/nrm-downstream-in" #define NRM_DEFAULT_URI "ipc:///tmp/nrm-downstream-event"
#define NRM_ENV_URI "ARGO_NRM_DOWNSTREAM_IN_URI" #define NRM_ENV_URI "ARGO_NRM_DOWNSTREAM_EVENT_URI"
#define NRM_START_FORMAT "{\"type\":\"application\", \"event\":\"start\", \"container\": \"%s\", \"uuid\": \"%s\", \"progress\": true, \"threads\": null}" #define NRM_START_FORMAT "{\"api\":\"down_event\", \"type\":\"application_start\", \"container_uuid\": \"%s\", \"application_uuid\": \"%s\"}"
#define NRM_PROGRESS_FORMAT "{\"type\":\"application\", \"event\":\"progress\", \"payload\": \"%lu\", \"uuid\": \"%s\"}" #define NRM_PROGRESS_FORMAT "{\"api\":\"down_event\", \"type\":\"progress\", \"payload\": %lu, \"application_uuid\": \"%s\"}"
#define NRM_PHASE_CONTEXT_FORMAT "{\"type\":\"application\", \"event\":\"phase_context\", \"cpu\": \"%u\", \"aggregation\": \"%u\", \"computetime\": \"%llu\", \"totaltime\": \"%llu\", \"uuid\": \"%s\"}" #define NRM_PHASE_CONTEXT_FORMAT "{\"api\":\"down_event\",\"type\":\"phase_context\", \"cpu\": %u, \"aggregation\": %u, \"computetime\": %llu, \"totaltime\": %llu, \"application_uuid\": \"%s\"}"
#define NRM_EXIT_FORMAT "{\"type\":\"application\", \"event\":\"exit\", \"uuid\": \"%s\"}" #define NRM_EXIT_FORMAT "{\"api\": \"down_event\", \"type\":\"application_exit\"}"
struct nrm_context* nrm_ctxt_create(void);
int nrm_ctxt_delete(struct nrm_context *);
struct nrm_context* nrm_ctxt_create(void); struct nrm_context* nrm_ctxt_create(void);
int nrm_ctxt_delete(struct nrm_context *); int nrm_ctxt_delete(struct nrm_context *);
...@@ -53,7 +56,7 @@ int nrm_send_phase_context(struct nrm_context *ctxt, ...@@ -53,7 +56,7 @@ int nrm_send_phase_context(struct nrm_context *ctxt,
inline long long int nrm_gettime(void) inline long long int nrm_gettime(void)
{ {
struct timespec now; struct timespec now;
clock_gettime(CLOCK_REALTIME, &now); clock_gettime(CLOCK_MONOTONIC, &now);
return ((now.tv_sec * 1e9) + now.tv_nsec); return ((now.tv_sec * 1e9) + now.tv_nsec);
} }
......