[Cubicweb] requests timeout on rqlcontroller

Jinpeng Li mr.li.jinpeng at gmail.com
Fri Jun 13 15:20:57 CEST 2014


Hi all,

Sorry for several emails today since they are different topics. I think
that it would be better to split them into different emails. Thanks in
advance if you read those long emails.

Let us start this topic with the below example again:

```
base_url = 'http://localhost:8080'
r = requests.Session()
a = r.get(base_url + "?__login=admin&__password=admin")
print a.status_code

url = base_url + "/rqlio/1.0"

args = [('INSERT Study ST: ST identifier "%s"' % study_id, {}),
              ('INSERT Subject SU: SU identifier "%s"' % subject_id, {}),
              ('SET SU related_studies ST WHERE ST eid %(t)s, SU eid %(u)s',
              {'t': '__r0', 'u':'__r1'}),]

a = requests.post(
                url,
                data=json.dumps(args),
                headers={'Content-Type': 'application/json'},
                verify=False,
                timeout=3)
```

We assume that Cubicweb server runs normally but with unstable network. We
assume that we lose the response from server and we get a requests timeout
error. Without understanding what is "args", how could I verify if my post
is executed correctly on the sever? (If I understand "args", for example
here, I can select entity to verify if I manage to insert entity. But, at
the low level design, it is hard to "understand" args.)

Considering current cubicweb development , any suggestion and any solution
to this problem?

In my opinion,  a simple webservice API could solve this problem :

```
    get_last_executed_rqls_and_res()
```

It returns the "last executed rqls", "timestamp", "rql responses (or error
message)" according to current http session.

Another more sophisticated proposition of APIs :

```
  id = get_new_rql_task_id()
  if id:
    run_rqls(id, rqls)
    res = get_reponse(id)
```

Thanks again for reading this email.

Regards,
Jinpeng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20140613/6c373f91/attachment.html>


More information about the Cubicweb mailing list