Pages: [1]
Guest

2005-04-22 07:33:48

I was wondering how to find out the current progress of work units. So I did some snooping. I quickly found I could grep the answer. But it wasn't "pretty". So I dove into Perl (which I have been attempting to learn). I am proud of my solution. I hope to continue to develop. Anyway, I'll include the script here for those who'd like to give it a try.

My only request is that you maintain the original by-line.

I don't know how well this will come out here, but I'll give it a try:
Code:
#!/usr/bin/perl

# by Chip Griffin (n1mie@mac.com)

# 04/15/2005

#

# Gets current percentage by looking in the client state file.



my $filename = '/Applications/boinc/client_state.xml';

# change the path to work for you

# the filename shouldn't change



open FILE, $filename or die "Can't open '$filename': $!";

# trap error for opening the file



my @strings = <FILE>; # extract file contents



my @matches = eval {

grep /fraction/, @strings; # look for the desired data

};



foreach $number (@matches) {

$number =~ s|</*fraction_done>||g; # strips xml codes

$number =~ s| *||g; # strips leading spaces

chomp($number); # get rid of end-of-line characters

if ($number < 1) { # necessary since Predictor gives weird numbers

$number *= 100; # makes it into a whole number

};

$number = int(($number * 10) + 0.5) / 10;

# change multiply/divide numbers in multiples

# of ten to change number decimal places to keep



$number .= "% completen"; # adds text to lines

};



print @matches; # output the formatted data


Good luck.
Grenadier
BAM!ID: 59
Joined: 2006-05-10
Posts: 255
Credits: 12,339,382
World-rank: 46,727

2005-04-22 18:11:43

Wouldn't it be easier to just look at the progress bar in BOINC Manager (or BOINCview)?
Guest

2005-04-22 19:05:07

This is a nice little script.

Great for the Linux workhorses who run from command line only.

Using Boincview would work fine from a remote system, but this is nice to have when your working local on a Linux box via cmd line only.

N1 Chip!
Guest

2005-04-23 12:45:43

Wouldn't it be easier to just look at the progress bar in BOINC Manager (or BOINCview)?


Um, guess it depends on what version you're using. There is no "progress bar" in the version I use! There is no graphics in the version I use. In fact, there is no obvious way to determine the current progress level. Hence the script. Besides, if you wanted to do something with the data you need access to it. You could use the data to send to your cell phone. You could use the data to update on a web page. Lots of stuff you could do with it. YMMV.

Happy crunching,
Pages: [1]

Index :: BOINCstats general :: Progress Monitor
Reason: