Re: Query regarding behavior of handle.deliver()

Venkateswara R Puvvada <[email protected]>
Newsgroups gmane.network.open-pegasus.general
Message-ID <OFEA22600D.2A7A57C1-ON652578FB.00169884-652578FB.00185CC5@in.ibm.com>
Ujjwal,

To reduce the network I/0 , Pegasus accumulates the response objects 
before sending to the client. The default threshold count is 100 and is 
controlled by the macro PEGASUS_RESPONSE_OBJECT_COUNT_THRESHOLD. The 
client should request the chunking or trailers to be able to receive the 
chunked responses. 

Venkat




From:   ujjwal lanjewar <[email protected]>
To:     Kirk Augustin <[email protected]>, Ajay N 
Rao/India/IBM@IBMIN
Cc:     "[email protected]" <[email protected]>, 
"[email protected]" <[email protected]>
Date:   27/08/2011 11:35
Subject:        Re: Query regarding behavior of handle.deliver()



Thank Kirk. The problem is handler.deliver() should really deliver the 
object/information to CIM client which it does not and instead wait for 
handler.complete() to be called only then information is delivered to CIM 
client all at once. I added Delay() in your code below as an example to 
show processing delays. With this if delay is 1 second, it would add up to 
over 2000 seconds before you can get the first instance. 
 
Regards
Ujjwal

From: Kirk Augustin <[email protected]>
To: ujjwal lanjewar <[email protected]>; Ajay N Rao <[email protected]>
Cc: "[email protected]" <[email protected]>; "[email protected]" 
<[email protected]>
Sent: Saturday, August 27, 2011 11:12 AM
Subject: Re: Query regarding behavior of handle.deliver()

It is okay to call handler.deliver for indications as many times as 
necessary to deliver the result.
It is incorrect to call handler.complete more than once per method 
invocation.

enumerateInstanceNames:
 
        if (className.equal(CLASS_A))
        {
                info_t *information = NULL;
 
                information = getinfo(); 
                if (information)
                {
                      for (int i=0; i<1234; i++)
                      {
                              // Deliver the names
                              // Delay() - Process before sending.
                              handler.deliver(..............);  
                      }
                      free((char *)information);
                }
 
                information = getinfo_1();
                if (information) {
                        for (int i=0; i<1234; i++)
                        {
                                // Deliver the names
                                // Delay() - Process before sending
                                handler.deliver(…………….);
                        }
                        free((char *)information);
                }
 
                handler.complete(); 
        }
 
Kirk Augustin
11821 NW McNamee Rd
Portland, OR 97231
From: ujjwal lanjewar <[email protected]>
To: Ajay N Rao <[email protected]>
Cc: "[email protected]" <[email protected]>; "[email protected]" 
<[email protected]>
Sent: Friday, August 26, 2011 9:53 PM
Subject: Re: Query regarding behavior of handle.deliver()

Thanks Ajay for your response. 
 
I see a problem here in the pegasus implementation. 
WBEM protocol allows us to send the enumeration immediately to WBEM Client 
as they are identified. I have confirmed that Windows WMI (WBEM 
implementation) also implements the same i.e. it allows objects to be sent 
to WBEM clients immediately instead of accumulating. 
 
There should be handler interface to send the objects delivered so far. 
i.e.. 
loop {
    handler.deliver(); // This should ideally send the object to CIM 
Client immediately
    handler.completesofar(); // OR there should be an additional interface 
to send the objects collected so far. 
} 
handler.complete(); // this would complete and render the handler invalid 
after this point.
 
Regards
Ujjwal

From: Ajay N Rao <[email protected]>
To: ujjwal lanjewar <[email protected]>
Cc: "[email protected]" <[email protected]>; [email protected]
Sent: Wednesday, August 24, 2011 9:38 AM
Subject: Re: Query regarding behavior of handle.deliver()

Hi ujjwal, 
If we do as follows: 
loop { 
    // Collect the instance 
    handler.deliver(instance)   // Deliver the instance 
    handler.complete()   // Send the delivered instance to client 
} 

Then the handler can not be used again after the handler.complete(). 
handler.deliver() will accumulate the objects one by one, and the 
handler.complete() will send all the instances to the client. 
I think after sending the one object the handler cannot be used again. 

Regards, 
Ajay   

From:        ujjwal lanjewar <[email protected]> 
To:        Ajay N Rao/India/IBM@IBMIN, "[email protected]" 
<[email protected]> 
Date:        08/24/2011 09:13 AM 
Subject:        Re: Query regarding behavior of handle.deliver() 



Hi Ajay, 
  
Swanand is talking about the case where say there are 1000 enumerations to 
be sent to client. Provider is going to take some time to collect 
information these 1000 instances, as it collects instances one at a time. 
  
The point is to send the first instance immediately to CIM client so that 
it can process that instance instead of waiting for all the 1000 
instances. This is how the WBEM protocol is designed. 
 
With the current provider example, this is not the case: 
  
loop { 
   // Collect the insance 
   handler.deliver(instance)  <--- This should sent the instance to CIM 
Client immediately. However this is not the case 
} 
handler.complete()  <---- This results in all the instances to be sent to 
to CIM Client however its too late, as it is outside of loop. 
  
Question is... 
  
Can we do something like this... 
  
loop { 
    // Collect the instance 
    handler.deliver(instance)   // Deliver the instance 
    handler.complete()   // Send the delivered instance to client 
} 
  
Regards 
Ujjwal 

From: Ajay N Rao <[email protected]>
To: [email protected]; [email protected]
Sent: Tuesday, August 23, 2011 3:55 AM
Subject: Re:Query regarding behavior of handle.deliver()



Hi swanand,

Pls refer sample providers given in the following path in the pegasus
directory:

src/Providers/sample/
src/Providers/sample/InstanceProvider

some of the providers use the same approach as mentioned by you in the
note.
for (each instance)
{
   .....
   handler.deliver(instance);
}
handler.complete();

Regards,
Ajay



From:    swanand Dunakhe <[email protected]>
To:    "[email protected]" <[email protected]>
Date:    08/23/2011 01:31 PM
Subject:    Query regarding behavior of handle.deliver()



Hi,
I have a query regarding behavior of handle.deliver().
Description says "The deliver function is used by providers to deliver
results to the CIM Server"
I need to return an enumeration to a CIM client, which will process the
enumeration iteratively.
The problem is, the Client can not gain a control to process the the
enumeration until all the objects in enumeration are accumulated at CIM
server.
The creation of objects may take a longer time, so we don't want all the
objects to be accumulated in an enumeration.
Once the object is collected at server side, it should be used by client
instead of waiting for all the enumeration,
Documentation says that the objects are delivered to server 
asynchronously,
but the client is waiting for all the objects to be filled up in
enumeration.
I need an iterative approach for the same. is there anything that can be
done to resolve the issue?
Note:handler.complete() gives the control to client and gets out of the
enumerateInstances() method, so I am using handler.complete() at the end.
e.g
//handler.processing();
//some code;
for (some conditions)
{
   //collect the cim instance and deliver;
   //handler.deliver() //I expect, the instance should be consumed by
client at this same point.
}
handler.complete(); //But client gets control after this statement.

Please let me know your inputs for the same.
Thanks,
Swa.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.