On 12/14/11 2:39 PM, Volker Braun wrote:
On Wednesday, December 14, 2011 8:29:53 PM UTC, jason wrote:
To send an initial computation, use the following POST data sent to the
/eval URL:
commands: string of commands to execute
session_id: make up some string identifier, it shouldn't matter what
it is
msg_id: make up some other string identifier, it shouldn't matter
what it is
sage_mode: whether to execute using Sage ("True") or plain python
("False")
So maybe this is where my confusion lies. If I make two sucessive posts
to the /eval url, should they
a) both have the same session_id and two different msg_ids, or
b) always random session and msg ids (4 random UUIDs for 2 requests)?
(b). They should certainly have two different session ids. The message
ids should be unique across all messages, so those should be unique too,
though I suppose maybe you could make the argument that the message ids
need to be unique just inside a session (but that's not what we assumed,
so I'm not sure if it will work).
Think of it as a routing protocol. The session id routes to the correct
Sage session, while the message id is just a unique identifier for the
message itself.
By the way, it looks like we actually do support a JSON protocol for the
/eval URL (which we use for interact evaluations, but it looks like you
can use it for starting up new computations too). Are you using this?
To use this, send a POST "message" field to /eval with the following
JSON form:
{"parent_header":{},
"header":{
"msg_id":"1ec1b4b4-722e-42c7-997d-e4a9605f5056",
"session":"c11a0761-910e-4c8c-b94e-803a13e5859a"},
"msg_type":"execute_request",
"content":{"code":"code to execute",
"sage_mode":true}}
The parent_header is {} since this is not a reply to a message. The
msg_id and session fields should be unique (if starting a new
computation). If you are instead sending an existing session a further
computation, the session should be that session's id (but the msg_id
still needs to be unique).
This "message" way of using /eval doesn't support uploading files right
now, which may be a reason to use the other way of sending data to /eval.
Jason
--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org