oodt-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject Re: Activity Logger in Commons
Date Fri, 18 Jul 2014 22:53:27 GMT
My pleasure, doctor.

The use case for the o.a.oodt.commons.activity package was to enable distributed logging mostly
for ascertaining performance of the OODT grid code.

For example, suppose we had an activity like "make some stew" and we suspected a bottleneck
in it somewhere, or we wanted to see what steps occurred; moreover "making stew" turned out
to be a distributed activity, involving CookTop, Oven, Fridge, etc., all running on different
hosts. The effort to make stew involves several incidents.

Make some classes:

	import o.a.oodt.commons.activity.Incident;
	public class BaconRenderedIncident extends Incident { ... }
	public class ChickenBrownedIncident extends Incident { ... }
	public class VegetablesChoppedIncident extends Incident { ... }
	public class WineBottleOppenedIncident extends Incident { ... }
	...

Set some properties:

	activity.host=some.host.over.there
	activity.port=4556

Create an activity factory:

	import o.a.oodt.commons.activity.DatagramLoggingActivityFactory;
	import o.a.oodt.commons.activity.ActivityStopped;
	...
	public class Kitchen {
		private factory = new DatagramLoggingActivityFactory():
		public void makeStew() {
			Activity activity = factory.createActivity();
			remoteCookTop.makeStew(activity.getID());
			remoteChoppingBlock.makeStew(activity.getID());
			activity.log(new ActivityStopped());
		}
	}
	pubic class CookTop {
		private factory = new DatagramLoggingActivityFactory():
		...
		public void makePasta() { ... }
		public void makeStew(String id) {
			Activity activity = factory.createActivity();
			activity.setID(id);
			renderBacon();
			activity.log(new BaconRenderedIncident());
			brownChicken();
			activity.log(new ChickenBrownedIncident());
			...
		}
	}
	public class ChoppingBlock {
		private factory = new DatagramLoggingActivityFactory():
		...
		public void chopFingers() { ... }
		public void makeStew(String id) {
			Activity activity = factory.createActivity();
			activity.setID(id);
			chopCarrots();
			activity.log(new CarrotsChoppedIncident());
			diceOnions();
			activity.log(new OnionsDicedIncident());
			...
		}
	}

Somewhere on the local network, start this:

	java -Dactivity.port=4556 -Dactivity.storage=o.a.oodt.commons.activity.StandardOutputStorage
o.a.oodt.commons.activity.DatagramLogger

Then when you make stew, you'll see on the standard output of the above process all of the
incidents that happened when you made stew.

You like XML, use XMLStandardOutputStorage. You want a database? Use SQLDatabaseStorage. Hosts
aren't all on a local network? Define your own ActivityFactory. Go wild.

Enjoy
--k

	


On 2014-07-18, at 3:06 PM, Lewis John Mcgibbney <lewis.mcgibbney@gmail.com> wrote:

> Hi Folks (specifically kelly),
> As part of our involvement with the DARPA XDATA [0] program of work, we are
> working with Draper Labs [1] on their Activity Logger (User-ALE) [2].
> We're in the process of porting the native JavaScript API to Java and
> embedding it within OODT for XDATA specific experiments.
> I wonder if someone (NutJob) could possibly descrbe what the /activity
> package in commons [3] does?
> Thanks in advance and BTW have a great weekend folks.
> Lewis
> 
> [0] http://www.darpa.mil/Our_Work/I2O/Programs/XDATA.aspx
> [1] http://www.draper.com/
> [2] http://draperlaboratory.github.io/user-ale/
> [3]
> https://svn.apache.org/repos/asf/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/activity/
> 
> -- 
> *Lewis*


Mime
View raw message