Re: Poll for output in Minions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
>         One thing we might be able to do on some methods is progress
> report. Certainly can't do it with all methods, but some you should
> be able to. Maybe argument the logging call with a param for progress
> (ie, I'm at 123 of 354).
>

I added an implementation for reporting the status as 'i'm at X of Y' 
Here is a video that uses curses for making stuff appears a little bit cooler 
:)
 Link : http://tutorials-place.com/media/makkalot_stuff/progress.htm

Using the stuff programatically : 

First make your method report its status like that : 
def run_str_log(self,command):
        import time

        self.run_str_log.logger.info("Starting counting logger ...")
        time.sleep(10)
        for i in range(50):
            time.sleep(1)
            #log the progress so other apps can poll for it
            self.run_str_log.logger.progress(i,50)

        return command


Then you can call it on Overlord with :

In [1]: from func.overlord.client import Overlord

In [2]: fc = Overlord("*",async=True)

In [3]: j = fc.echo.run_str_log("bli")

In [4]: j
Out[4]: '*-echo-run_str_log-1249216433.5550549'

In [6]: fc.check_progress(j,"acerfedora")
Out[6]: ({'acerfedora': [8, 50]}, False)

In [7]: fc.check_progress(j,"acerfedora")
Out[7]: ({'acerfedora': [10, 50]}, False)

In [8]: fc.check_progress(j,"acerfedora")
Out[8]: ({'acerfedora': [12, 50]}, False)

In [9]: fc.check_progress(j,"acerfedora")
Out[9]: ({'acerfedora': [14, 50]}, False)

In [10]: fc.check_progress(j,"acerfedora")
Out[10]: ({'acerfedora': [15, 50]}, False)

Pretty easy to use, to make API code usable in your
applications you may take a look at func/ovelord/cmd_modules/call.py

Ideas,comments ? 
Branch : logger
REPO : http://github.com/makkalot/func/tree/logger

_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux