Rigorous and Reliable (RAR)
procone.py -- OMUD - Printable Version

+- Rigorous and Reliable (RAR) (http://rar.shufangkeji.com:60380)
+-- Forum: 大计算 (/forumdisplay.php?fid=257)
+--- Forum: 应用 (/forumdisplay.php?fid=363)
+---- Forum: BIBO (/forumdisplay.php?fid=602)
+---- Thread: procone.py -- OMUD (/showthread.php?tid=9166)


procone.py -- OMUD - zhihao - 09-25-2020 01:15 AM

procone.py is used for generating analysis result for one case.

在某一案例内容中搜索key{1,2,3},构建"keys": []。
Code:
main() {
    set $tycajson_pfn as a insert.json
    get $reqtype from $tycajson_pfn
    switch ($reqtype) {
        case "delete":
            deleteIfMatch()
        case "select"
            selectIfMatch()
        deault:
            query()
    }
}

deleteIfMatch()
Code:
casecnt: current case count
biboext: $bibo_share/bibo-ext.pcf , records current case count
tycajson_pfn: file of json cases
blank_json: the value of is {"opstatus":"deleted"}
deleteIfMatch() {
    rr=0
    if $reqcaseid matches $caseid{
        rid --insitu $tycajson_pfn
        create file $tycajson_pfn with $blank_json
        
        pcf --pcf $biboext --add bibo_doc_cnt ${casecnt}+1
        coolauntie rm $tycano
        rr = 105
    }
    return rr
}

selectIfMatch()
Code:
tycajson_pfn: file of json cases
reqcaseid: reqest case id
caseid: id of existing case
tycano: case number it selects

selectIfMatch() {
    if $reqcaseid matches $caseid
        return tycano
}

query()
Code:
query() {
    generate query response
}

delete_one_case():
Code:
fw: file handler of one result file
newftexts: request content
insblock: content of insert block of the case in the corpus
blank_json: the value of is {"opstatus":"deleted"}
delete_one_case(fw, newftexts, insblock){
  caseid = get caseid from insblock
  newcaseid = get caseid from newftexts
  if ($caseid  == $newcaseid){
    write $blank_json to $fw
  }
}

---
20210813/zhihao: update blank_json
20210811/zhihao: add selectIfMatch
20210811/zhihao: add delete_one_case
20200926/zhihao: add switch in main()


RE: procone.py -- OMUD - zhihao - 09-25-2020 01:31 AM

(09-25-2020 01:15 AM)zhihao Wrote:  deleteIfMatch()
Code:
deleteIfMatch() {
    if $reqcaseid matches $caseid
        rid --insitu insert.json
        create file insert.json with request template which has empty value
}

根据要求修改逻辑
Quote:After the match-and-delete, we should generate a result file to report the result of the deletion. If there is no match and no deletion, the result file is a nil file -- a file with zero bytes.

设计如下:
Code:
deleteIfMatch() {
    if $reqcaseid matches $caseid
        rid --insitu insert.json
        create file insert.json with request template which has empty value
        generate result file
    else
        create empty result file
}



RE: procone.py -- OMUD - lingu - 09-26-2020 12:38 PM

(09-25-2020 01:15 AM)zhihao Wrote:  if $reqtype is "delete"
deleteIfMatch()
else
query()
}

Pls make it a switch although the implementation may use if/else

There is a branch for 'select', right?


RE: procone.py -- OMUD - zhihao - 09-26-2020 04:34 PM

(09-26-2020 12:38 PM)lingu Wrote:  
(09-25-2020 01:15 AM)zhihao Wrote:  if $reqtype is "delete"
deleteIfMatch()
else
query()
}

Pls make it a switch although the implementation may use if/else

There is a branch for 'select', right?

updated as follows:
Code:
switch ($reqtype) {
    case "delete":
        deleteIfMatch()
    case "select"
        selectIfMatch()
    deault:
        query()
}



RE: procone.py -- OMUD - lingu - 09-26-2020 06:27 PM

(09-26-2020 04:34 PM)zhihao Wrote:  
(09-26-2020 12:38 PM)lingu Wrote:  
(09-25-2020 01:15 AM)zhihao Wrote:  if $reqtype is "delete"
deleteIfMatch()
else
query()
}

Pls make it a switch although the implementation may use if/else

There is a branch for 'select', right?

should answer the question!

Quote:updated as follows:
Code:
switch ($reqtype) {
    case "delete":
        deleteIfMatch()
    case "select"
        selectIfMatch()
    deault:
        query()
}

As far as I can tell, we haven't implemented those functions, yet. We should implement them, soon. When implementing them, make sure to run the tests using 'make test' frequently and make sure all tests are happy.


RE: procone.py -- OMUD - zhihao - 09-26-2020 07:05 PM

(09-26-2020 06:27 PM)lingu Wrote:  
(09-26-2020 04:34 PM)zhihao Wrote:  
(09-26-2020 12:38 PM)lingu Wrote:  
(09-25-2020 01:15 AM)zhihao Wrote:  if $reqtype is "delete"
deleteIfMatch()
else
query()
}

Pls make it a switch although the implementation may use if/else

There is a branch for 'select', right?

should answer the question!
Yes, I miss the branch 'select' and added it into headpost

(09-26-2020 06:27 PM)lingu Wrote:  
Quote:updated as follows:
Code:
switch ($reqtype) {
    case "delete":
        deleteIfMatch()
    case "select"
        selectIfMatch()
    deault:
        query()
}

As far as I can tell, we haven't implemented those functions, yet. We should implement them, soon. When implementing them, make sure to run the tests using 'make test' frequently and make sure all tests are happy.

OK


RE: procone.py -- OMUD - lingu - 11-30-2020 01:13 PM

(09-25-2020 01:15 AM)zhihao Wrote:  procone.py is used for generating analysis result for one case.

Code:
在某一案例内容中搜索key{1,2,3},构建"keys": []。
Code:
main() {
    set $tycajson_pfn as a insert.json
    get $reqtype from $tycajson_pfn
    switch ($reqtype) {
        case "delete":
            deleteIfMatch()
        case "select"
            selectIfMatch()

how does 'selectIfMatch' work? Pls specify.


RE: procone.py -- OMUD - zhihao - 08-10-2021 01:58 PM

(09-25-2020 01:15 AM)zhihao Wrote:  
Code:
deleteIfMatch() {
    if $reqcaseid matches $caseid
        rid --insitu insert.json
((->tycajson_pfn: file of json cases
rid --insitu ((insert.json->$tycajson_pfn ))
))
RR lingu

(09-25-2020 01:15 AM)zhihao Wrote:  
Code:
create file insert.json with request template which has empty value
create file ((insert.json->$tycajson_pfn )) with request template which has empty value
RR lingu

(09-25-2020 01:15 AM)zhihao Wrote:  
Code:
generate result file
    else
        create empty result file
}
delete logic
RR lingu


RE: procone.py -- OMUD - lingu - 08-11-2021 06:57 PM

(08-10-2021 01:58 PM)zhihao Wrote:  
(09-25-2020 01:15 AM)zhihao Wrote:  
Code:
deleteIfMatch() {
    if $reqcaseid matches $caseid
        rid --insitu insert.json
((->tycajson_pfn: file of json cases
rid --insitu ((insert.json->$tycajson_pfn ))
))
RR lingu

(09-25-2020 01:15 AM)zhihao Wrote:  
Code:
create file insert.json with request template which has empty value
create file ((insert.json->$tycajson_pfn )) with request template which has empty value
RR lingu

OK.

Quote:
(09-25-2020 01:15 AM)zhihao Wrote:  
Code:
generate result file
    else
        create empty result file
}
delete logic
RR lingu

without a result file, how does the client know the status of the delete op?


RE: procone.py -- OMUD - zhihao - 08-11-2021 08:24 PM

add delete_one_case() to headpost according to http://rar.shufangkeji.com:60380/showthread.php?tid=9629&pid=48416#pid48416
Code:
fw: file handler of one result file
newftexts: request content
insblock: content of insert block of the case in the corpus
blank_json: the value of -- {"keys":[],"caseid":"___"}
delete_one_case(fw, newftexts, insblock){
  caseid = get caseid from insblock
  newcaseid = get caseid from newftexts
  if ($caseid  == $newcaseid){
    write $blank_json to $fw
  }
}



RE: procone.py -- OMUD - zhihao - 08-12-2021 11:28 AM

(09-25-2020 01:15 AM)zhihao Wrote:  delete_one_case():
Code:
fw: file handler of one result file
newftexts: request content
insblock: content of insert block of the case in the corpus
blank_json: the value of is {"keys":[],"caseid":"___"}
delete_one_case(fw, newftexts, insblock){
  caseid = get caseid from insblock
  newcaseid = get caseid from newftexts
  if ($caseid  == $newcaseid){
    write $blank_json to $fw
  }
}

delete the logic, we reuse the old one deleteIfMatch


RE: procone.py -- OMUD - zhihao - 08-12-2021 11:32 AM

(08-11-2021 06:57 PM)lingu Wrote:  
(08-10-2021 01:58 PM)zhihao Wrote:  
(09-25-2020 01:15 AM)zhihao Wrote:  
Code:
deleteIfMatch() {
    if $reqcaseid matches $caseid
        rid --insitu insert.json
((->tycajson_pfn: file of json cases
rid --insitu ((insert.json->$tycajson_pfn ))
))
RR lingu

(09-25-2020 01:15 AM)zhihao Wrote:  
Code:
create file insert.json with request template which has empty value
create file ((insert.json->$tycajson_pfn )) with request template which has empty value
RR lingu

OK.

Quote:
(09-25-2020 01:15 AM)zhihao Wrote:  
Code:
generate result file
    else
        create empty result file
}
delete logic
RR lingu

without a result file, how does the client know the status of the delete op?

It won't know and the logic is not implemented in code, deleted else part


RE: procone.py -- OMUD - zhihao - 08-12-2021 11:43 AM

(11-30-2020 01:13 PM)lingu Wrote:  
(09-25-2020 01:15 AM)zhihao Wrote:  procone.py is used for generating analysis result for one case.

Code:
在某一案例内容中搜索key{1,2,3},构建"keys": []。
Code:
main() {
    set $tycajson_pfn as a insert.json
    get $reqtype from $tycajson_pfn
    switch ($reqtype) {
        case "delete":
            deleteIfMatch()
        case "select"
            selectIfMatch()

how does 'selectIfMatch' work? Pls specify.

add to headpost
Code:
tycajson_pfn: file of json cases
reqcaseid: reqest case id
caseid: id of existing case
tycano: case number it selects
selectIfMatch() {
    if $reqcaseid matches $caseid
        return tycano
}



RE: procone.py -- OMUD - zhihao - 08-12-2021 12:14 PM

(09-25-2020 01:15 AM)zhihao Wrote:  deleteIfMatch()
Code:
tycajson_pfn: file of json cases
deleteIfMatch() {
    if $reqcaseid matches $caseid
        rid --insitu $tycajson_pfn
        create file $tycajson_pfn with request template which has empty value

need to remove case in sage with auntie
---
use auntie to delete case in sage


RE: procone.py -- OMUD - zhihao - 08-13-2021 07:36 PM

(09-25-2020 01:15 AM)zhihao Wrote:  deleteIfMatch()
Code:
use auntie to delete case in sage
}

find little info about auntie after I search in tab, cod://sage-src/src/auntie/auntie.cpp has some infos, looks like no remove operation

Code:
void usage() {
  printf (("\
Usage: auntie [--dryrun] [up | down | list | pushmove | register] [...] \n\
  up        starts a KissUp operation,\n              which stores (uploads) the file \n\
  down      auntie down requests a KissDown operation,\n              which provides (downloads)\n              the file in  the  name <filename> \n\
  list      auntie list lists the currently stored keys in GFAT.\n              These are similar to the filenames\n              of files in the GFAT system \n\
  pushmove  auntie [--dryrun] pushmove <filename>\n              <hostname> <id> <suffix>\n              pushes the file to EFS of the helper_portal \n\
  register  auntie [--dryrun] register <filename>\n              auntie register registers a task \n              specification file with Sage \n\
  dryrun    auntie [--dryrun] \n              If --dryrun is specified, auntie conducts a dryrun\n              and does not really upload or download the data\n"));

}

try list some files
Code:
[sage@limbo305-1 test]$ /thinker/globe/.think/run/auntie list
[sage@limbo305-1 test]$



RE: procone.py -- OMUD - lingu - 08-14-2021 12:35 AM

(08-12-2021 12:14 PM)zhihao Wrote:  
(09-25-2020 01:15 AM)zhihao Wrote:  deleteIfMatch()
Code:
tycajson_pfn: file of json cases
deleteIfMatch() {
    if $reqcaseid matches $caseid
        rid --insitu $tycajson_pfn
        create file $tycajson_pfn with request template which has empty value

need to remove case in sage with auntie
---
use auntie to delete case in sage

To remove the file from Sage, the program decrements casecnt, then runs 'coolauntie rm $tycano' and returns 105.

RR zhihao


RE: procone.py -- OMUD - lingu - 08-14-2021 12:37 AM

(08-13-2021 07:36 PM)zhihao Wrote:  
(09-25-2020 01:15 AM)zhihao Wrote:  deleteIfMatch()
Code:
use auntie to delete case in sage
}

find little info about auntie after I search in tab, cod://sage-src/src/auntie/auntie.cpp has some infos, looks like no remove operation

Code:
void usage() {
  printf (("\
Usage: auntie [--dryrun] [up | down | list | pushmove | register] [...] \n\
  up        starts a KissUp operation,\n              which stores (uploads) the file \n\
  down      auntie down requests a KissDown operation,\n              which provides (downloads)\n              the file in  the  name <filename> \n\
  list      auntie list lists the currently stored keys in GFAT.\n              These are similar to the filenames\n              of files in the GFAT system \n\
  pushmove  auntie [--dryrun] pushmove <filename>\n              <hostname> <id> <suffix>\n              pushes the file to EFS of the helper_portal \n\
  register  auntie [--dryrun] register <filename>\n              auntie register registers a task \n              specification file with Sage \n\
  dryrun    auntie [--dryrun] \n              If --dryrun is specified, auntie conducts a dryrun\n              and does not really upload or download the data\n"));

}

try list some files
Code:
[sage@limbo305-1 test]$ /thinker/globe/.think/run/auntie list
[sage@limbo305-1 test]$

If list does not work, file a bug, write a test for it, and debug to fix the problem.


RE: procone.py -- OMUD - zhihao - 08-14-2021 01:04 PM

(08-14-2021 12:35 AM)lingu Wrote:  
(08-12-2021 12:14 PM)zhihao Wrote:  
(09-25-2020 01:15 AM)zhihao Wrote:  deleteIfMatch()
Code:
tycajson_pfn: file of json cases
deleteIfMatch() {
    if $reqcaseid matches $caseid
        rid --insitu $tycajson_pfn
        create file $tycajson_pfn with request template which has empty value

need to remove case in sage with auntie
---
use auntie to delete case in sage

To remove the file from Sage, the program decrements casecnt, then runs 'coolauntie rm $tycano' and returns 105.

RR zhihao

good to me
---
Code:
casecnt: current case count
biboext: $bibo_share/bibo-ext.pcf , records current case count

        pcf --pcf $biboext --add bibo_doc_cnt ${casecnt}+1
        coolauntie rm $tycano
        rr = 105



RE: procone.py -- OMUD - zhihao - 08-14-2021 06:30 PM

(08-14-2021 12:37 AM)lingu Wrote:  
(08-13-2021 07:36 PM)zhihao Wrote:  
(09-25-2020 01:15 AM)zhihao Wrote:  deleteIfMatch()
Code:
use auntie to delete case in sage
}

find little info about auntie after I search in tab, cod://sage-src/src/auntie/auntie.cpp has some infos, looks like no remove operation

Code:
void usage() {
  printf (("\
Usage: auntie [--dryrun] [up | down | list | pushmove | register] [...] \n\
  up        starts a KissUp operation,\n              which stores (uploads) the file \n\
  down      auntie down requests a KissDown operation,\n              which provides (downloads)\n              the file in  the  name <filename> \n\
  list      auntie list lists the currently stored keys in GFAT.\n              These are similar to the filenames\n              of files in the GFAT system \n\
  pushmove  auntie [--dryrun] pushmove <filename>\n              <hostname> <id> <suffix>\n              pushes the file to EFS of the helper_portal \n\
  register  auntie [--dryrun] register <filename>\n              auntie register registers a task \n              specification file with Sage \n\
  dryrun    auntie [--dryrun] \n              If --dryrun is specified, auntie conducts a dryrun\n              and does not really upload or download the data\n"));

}

try list some files
Code:
[sage@limbo305-1 test]$ /thinker/globe/.think/run/auntie list
[sage@limbo305-1 test]$

If list does not work, file a bug, write a test for it, and debug to fix the problem.

ok, it recorded in 2016