Reputation: 8792
I have a long-running function on OpenCPU which takes around 1 hour or so to complete.
I read that OpenCPU now sends session ids and we can retrieve the session id and ping back later to retrieve the output. But when I run my code, the session id is not present in the response.
Here is the relevant section of my code
let uri= "http://IP/ocpu/library/mypackage/R/myfunction/json"
const formData = {
'param1' : 'value1',
'param2' : 'value2',
'file1': fs.createReadStream('files/.....'),
'file2': fs.createReadStream('files/...'),
'file3': fs.createReadStream('files/....')
};
const response = await request.post({
uri: url,
formData: formData,
headers: { 'Content-Type': 'multipart/form-data' }
qs: { async: true }
});
console.log(response);
The response I get is
{"uri":{"protocol":"http:","slashes":true,"auth":null,"host":"..myIP..","port":80,"hostname":"MYIP","hash":null,"search":null,"query":null,"pathname":"/ocpu/library/mypackage/R/myfunction/json","path":"/ocpu/library/..../R/...../json","href":"http://MYIP/ocpu/library/mypackage/R/myfunction/json"},"method":"POST","headers":{"Content-Type":"multipart/form-data","host":"MYIP"}}
It does not have the session details.
What am I doing wrong?
Upvotes: 1
Views: 90