I'm trying to decide how to adapt my current code to use with picloud. Everything is currently running fine, but I'm not sure about how to save results.The code is long-running monte-carlo simulation. As it's currently structured, it can periodically save the info I need (includes all simulation parameters and results) in pickle format to a file. I notice that running in picloud, this model (saving to a file) doesn't work (permission denied writing the file). Also, I believe such a file would not persist after the job completes?
I'm not sure what's a good alternative. Some ideas:1. Write periodic results to /tmp. (Would this persist after the job completes?)
2. As it is now, there is 1 function run in picloud, which would return a pickle of results if/when it completes. However, I don't always want to wait that long, and might want intermediate results. I could restructure this so the function returns more often with intermediate results - but this would be a bit of work.
Suggestions?
I tried:
on server (cloud side):
periodically:
cloud.files.putf(opt.logname, dumps (results, -1))
The function is running and no exceptions. On the client side, in a seperate
process (not the one that is waiting on the function result), I do:
cloud.setkey(api_key=1478, api_secretkey='xxx)
print cloud.files.list() <<<< this line prints '[]', an empty list
So my file is not found, and for that matter, no files are listed.
from cPickle import loads
res = loads
(cloud.files.getf('test_8psk_cancel_lms_olddemod.py.nbecker6.hughes.com.bbd8025fa4bf2f8ebf1f6c281b7a1fa1.err'))
python ./read_cloud.py
[]
[Tue Nov 08 12:04:18 2011] - [ERROR] - Cloud.HTTPConnection: rawquery:
received error from server: Status 492: The specified file was not found.
Traceback (most recent call last):
File "./read_cloud.py", line 28, in <module>
res = loads
(cloud.files.getf('test_8psk_cancel_lms_olddemod.py.nbecker6.hughes.com.bbd8025fa4bf2f8ebf1f6c281b7a1fa1.err'))
File "/usr/lib/python2.7/site-packages/cloud/files.py", line 419, in getf
resp = conn.send_request(_file_get_query, {'name': file_name})
File "/usr/lib/python2.7/site-packages/cloud/transport/network.py", line
412, in send_request
log_cloud_excp = log_cloud_excp)
File "/usr/lib/python2.7/site-packages/cloud/transport/network.py", line
307, in send_request_helper
retry=resp['retry'], logger=cloudLog)
cloud.cloud.CloudException: Status 492: The specified file was not found.
One thing though:
"cloud.setkey() must be called before using any functions in this module."
On the server (cloud) side, I had forgotten to include cloud.setkey(). I
would have expected an exception, but I don't think I got one.