Skip to content

Commit

Permalink
Merge branch 'release/2.0.20'
Browse files Browse the repository at this point in the history
Fix minDuration / maxDuration and datetime filtering capability
  • Loading branch information
gfenoy committed Sep 5, 2023
2 parents cf87ad6 + e53ee9c commit 9c42a8e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
21 changes: 14 additions & 7 deletions 3ty/proc-comm-zoo-1.2-alpha/assets/patch/zoo/service_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -1699,11 +1699,7 @@ extern "C" {
bool isFilteredDMM(maps* pmsConf,const char* pccPid){
#ifndef RELY_ON_DB
maps* pmsRequest=getMaps(pmsConf,"request");
fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
if(pmsRequest!=NULL){
fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
dumpMap(pmsRequest->content);
fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
map* pmTmpPath=getMapFromMaps(pmsConf,"main","tmpPath");
map* pmMinDate=getMap(pmsRequest->content,"minDuration");
map* pmMaxDate=getMap(pmsRequest->content,"maxDuration");
Expand Down Expand Up @@ -1842,7 +1838,8 @@ extern "C" {
if(dirp!=NULL){
while ((dp = readdir (dirp)) != NULL){
char* extn = strstr(dp->d_name, ".json");
if(extn!=NULL && strstr(dp->d_name,"_status")==NULL){
// d_name length should be the usid length (36) + ".json" extension
if(extn!=NULL && strstr(dp->d_name,"_status")==NULL && strlen(dp->d_name)==41){
char* tmpStr=zStrdup(dp->d_name);
tmpStr[strlen(dp->d_name)-5]=0;
#ifndef RELY_ON_DB
Expand All @@ -1854,6 +1851,9 @@ extern "C" {
pmsLenv->child = NULL;
pmsLenv->next = NULL;
map *pmaPid=NULL,*pmaUsid=NULL;
// In case we have jrequest defined in the _lenv.cfg file
int saved_stdout = zDup (fileno (stdout));
zDup2 (fileno (stderr), fileno (stdout));
if(conf_read(pcaLenvPath,pmsLenv) !=2){
map *pmTmp=getMapFromMaps(pmsLenv,"lenv","Identifier");
if(pmTmp!=NULL){
Expand All @@ -1874,12 +1874,19 @@ extern "C" {
pmaPid=NULL;
pmaUsid=NULL;
}
fflush(stdout);
fflush(stderr);
//rewind(stdout);
//fpurge(saved_stdout);
zDup2 (saved_stdout, fileno (stdout));
zClose (saved_stdout);
free(pcaLenvPath);
#else
map *pmaPid=NULL, *pmaUsid=NULL;
#endif
if(isFilteredPid(conf,pmaPid->value) &&
isFilteredDMM(conf,pmaUsid->value)){
if((pmaPid==NULL && pmaUsid==NULL) ||
(isFilteredPid(conf,pmaPid->value) &&
isFilteredDMM(conf,pmaUsid->value))){
if(cnt>=skip && cnt<limit+skip){
json_object* cjob=printJobStatus(conf,tmpStr);
json_object_array_add(res,cjob);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,24 +434,28 @@ void setRootUrlMap(maps* m){
int canContinue=false;
char **orig = environ;
char *s=*orig;
char workspace[1024*2];
char* pWorkspace = NULL;
memset(workspace,0,1024*2);
for (; s; ei++ ) {
if (strstr(s,"EOEPCA_WORKSPACE")!=NULL){
char* baseU=strchr(s,'=');
if (strlen(baseU)>1){
pWorkspace = ++baseU;
}
break;
}
s = *(orig+ei);
}
if (pWorkspace){
// TODO: verify if we should optionaly prepend with rootHost
if(rootHost!=NULL)
char* workspace;
if(rootHost!=NULL){
workspace=(char*)malloc((strlen(rootHost->value)+strlen(rootPath->value)+3)*sizeof(char));
sprintf(workspace, "%s/%s/%s",rootHost->value,pWorkspace,rootPath->value);
else
}
else{
workspace=(char*)malloc((strlen(rootPath->value)+3)*sizeof(char));
sprintf(workspace, "/%s/%s",pWorkspace,rootPath->value);
}
fprintf(stderr,"---------WORKSPACE: %s--------------\n",workspace);
setMapInMaps(m,"openapi","rootUrl",workspace);
}
Expand Down Expand Up @@ -3596,7 +3600,7 @@ runRequest (map ** inputs)
char *tmps0 = strtok_r(pmTmp->value, ",", &saveptr0);
int iCnt0=0;
while(tmps0 != NULL){
if(iCnt0>0){
if(iCnt0>=0){
char *saveptr;
char *tmps = strtok_r(tmps0, "/", &saveptr);
int iCnt=0;
Expand Down Expand Up @@ -3685,8 +3689,6 @@ runRequest (map ** inputs)
}else{
free(pcaClauseFinal);
}
maps* pmsTmp=getMaps(m,"lenv");
dumpMap(pmsTmp->content);
if(res!=NULL)
json_object_put(res);
res=printJobList(m);
Expand Down Expand Up @@ -4047,7 +4049,6 @@ runRequest (map ** inputs)
if(res!=NULL)
json_object_put(res);
res=printJobStatus(m,pmTmp->value);
fprintf(stderr,"%s %d \n", __FILE__,__LINE__);
}
//printHeaders(m);
//printf("Status: 201 Created \r\n\r\n");
Expand Down
3 changes: 2 additions & 1 deletion build.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
docker_image_name: eoepca/proc-ades
docker_image_version: 2.0.19
docker_image_version: 2.0.20

0 comments on commit 9c42a8e

Please sign in to comment.