[OTDev] Receiving task

Nina Jeliazkova jeliazkova.nina at gmail.com
Fri Feb 25 14:46:13 CET 2011


Dmitry,

On 25 February 2011 15:25, Druzhilovsky <dmitry.druzhilovsky at ibmc.msk.ru>wrote:

> Dear Nina,
>
>
>
> >I've asked in the previous email - why you have dataset  from
> apps.ideaconsult , but upload results into the other server ? Any reason for
> that, or just a mistake ?
>
>
>
> [Druzhilovsky]
>
>
>
> Hm, what is wrong? It works both apps.ideaconsult and ambit.uni-plovdiv.
>

Yes, it should work by definition :)

But it is less efficient,  URIs will change when copying datasets from one
to other server, and also  ambit.uni-plovdiv. is for testing only, meaning
we feel free to drop the database content at any time.



> For rightness, let it go at that :
>
>
>
> curl -X POST -d dataset_uri=
> https://ambit.uni-plovdiv.bg:8443/ambit2/dataset/2765 -d dataset_service=
> https://ambit.uni-plovdiv.bg:8443/ambit2/dataset -d username=OTLogin -d
> password=OTPassword http://195.178.207.160/OpenTox/MakeMNA -iv
>
>
>
> See below:
>
>
>
>
>
> From: Nina Jeliazkova [mailto:jeliazkova.nina at gmail.com]
> Sent: Friday, February 25, 2011 1:57 PM
> To: opentox development mailing list
> Cc: Druzhilovsky
> Subject: Re: [OTDev] Receiving task
>
>
>
> Dear Dmitry,
>
> On 25 February 2011 12:35, Druzhilovsky <dmitry.druzhilovsky at ibmc.msk.ru>
> wrote:
>
> Dear Nina, All
>
> I would like to ask you a technical question. Last week I fixed a code of
> MNA\QNA services and
> dashed against next problem. When I receive request, for example:
>
> curl -X POST -d dataset_uri=
> https://apps.ideaconsult.net:8443/ambit2/dataset/2765 -d dataset_service=
> https://ambit.uni-plovdiv.bg:8443/ambit2/dataset -d username=OTlogin -d
> password=OTPassword http://195.178.207.160/OpenTox/MakeMNA -iv
>
> I have next stages:
> 1. Service checks presence of dataset
> https://apps.ideaconsult.net:8443/ambit2/dataset/2765 and if it presents,
> service uploads it.
>
>
> I guess you mean MNA service downloads the dataset ?  How do you check the
> "presense" of the dataset ? If you do GET , it is already a download of
> dataset, and if I understood right, you are actually doing two GET requests
> on this dataset?
>
>
>
> [Druzhilovsky]
>
> MNA service doesn’t look whether there is database. Firstly service sends
> request to Ambit for authentication, but after that service downloads
> dataset.
>
>
>
I don't really understand - authentication requests should be sent to
OpenSSO policy service, not to Ambit. Ambit expects only tokens.
Do you send one requests or more to ambit in order to retrieve a dataset?


>
>
>
>
> 2. Service returns a token.
>
>
> e.g. you send the user and password to the OpenSSO Policy service and
> receive an OpenSSO token ?  If yes, you should do this as a first step,
> otherwise when our server will go protected, you will not be able to
> retrieve the data.
>
> Or did I misunderstood ?
>
>
>
> [Druzhilovsky]
>
> You are absolutely right! In the first place service looks whether user has
> access for login to our service, after that service looks whether user has
> access for dataset.
>
>
>
>
But looking whether the user has access for a dataset is not the job of MNA
service, but dataset (Ambit in this case ) service.  Ambit will send request
to policy service anyway, regardless of whether MNA already send such
request.  So there is really no need to do that from your side.


>
>
>
> 3. Service gives request to
> https://ambit.uni-plovdiv.bg:8443/ambit2/dataset and receives task.
>
>
> MNA service sends POST request to ambit.uni-plovdiv server to upload
> calculated descriptiors, right ?
>
>
> 4. Service sends data into dataset in compliance with task dataset.
>
>
> It is not quite clear to me, but in general, the (MNA) service should have
> already send the data for upload and just polling the task.  It is not
> necessary to wait for the task completion, neither to retrieve the result
> dataset.
>
>
>
> [Druzhilovsky]
>
> Hm…if I send dataset entirely then I don’t need to know which dataset I
> received, I have to know only “task”.


When the task is completed, it will point to the result dataset - please
consult the task API !   And in fact the calculation service don't need to
know the result dataset ID - the client will find it when querying task
URIs.


> But early you told me that opentox rule needs the task immediately.
>  Therefore MNA\QNA service divides dataset and sends compounds  one by one.
> If service speed is not important, we can change work of service, it make
> better.
>
>
>
>
This is not the best way to return the task immediately from your side.  On
the contrary, it seems lot less efficient.

When a calculation service starts a calculation, it returns a task of its
own, not a task of the dataset service. You could generate your own task URI
immediately after receving calculation request, even before starting to
perform any calculation . This is what status Queued is for.

Then you generate your data locally as RDF file (or in database, etc.) and
then POST the RDF to the dataset service. At this point you already have a
task of the dataset service, but you don't need to wait for its completion.
The only thing to do is that your (MNA) task for calculation now will return
code 201 and the URI of the dataset service task.


>
>
>
>
> Not difficult... but for good working of REST PHP I had to make some
> supplements and it makes service work very long. May be you can help me, how
> I have to change a work of our services. Look:
>
> Now I receive a task only after service (MNA or QNA) puts the first
> compound in https://ambit.uni-plovdiv.bg:8443/ambit2/dataset (i.c.
> https://ambit.uni-plovdiv.bg:8443/ambit2/dataset/63684). After that
> service begins to add all next data by means of PUT and constantly listens
> "task". That is, each subsequent structure is put in base using URI
> https://ambit.uni-plovdiv.bg:8443/ambit2/dataset/63684.   This schema
> brings to the cycle and growth of process time.
> 1. Whether there is a possibility that service received "task" prior to it
> sent first structure?
> 2. Whether there is a possibility that service could put data using only
> task (without dataset uri)?
>
>
> That's definitely not the most efficient way.
>
> Why not just storing the entire RDF of the dataset locally , until it is
> completed , and then post the RDF to the dataset service.  Just one POST and
> not need to listen to task completion at all.
>
>
>
> [Druzhilovsky]
>
>
>
> Yes,it is really optimally, and we can make so, but we can’t give task ID
> until calculations will not be finished (i.c. through about 2 hours).


Why not - see above .

HTTP connection will not survive for 2 hours, so the client will be dropped
before  it learns where the result is.




> It schema was made to produce task ID the sooner the better. If user will
> be tired to wait, he can see part of the base by this. PHP can’t work in
> background mode and if PHP will be disconnected then all will stop.
>
>
>
Hm, why PHP is an issue here - I had an impression you do calculations in
Delphi ?
Even if the web front end is PHP, isn't it possible just to invoke the
Delphi calculations via PHP, generate task ID for that and return this
immediately via PHP.  Then the client will GET on this task ID and you will
return completed/not result, depending on the status of your calculations.
Am I missing something?

Best regards,
Nina


>
>
>
> Best regards
>
> Dmitry S. Druzhilovsky
>
> Laboratory of Structure-Function Based Drug Design
> 119121, Russia, Moscow, Pogodinskaya street, 10
> Phone: +7 499 255-30-29
> Fax: +7 499 245-08-57
>
>
> _______________________________________________
> Development mailing list
> Development at opentox.org
> http://www.opentox.org/mailman/listinfo/development
>
>
>
> _______________________________________________
> Development mailing list
> Development at opentox.org
> http://www.opentox.org/mailman/listinfo/development
>



More information about the Development mailing list