Announcement: Java-based sample broker implementation available

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Announcement: Java-based sample broker implementation available

grampajohn
Administrator

Dear colleagues -

I believe our sample broker implementation is now ready to try out and build on. In the process of putting this together I have found and corrected a number of small problems in the server and the server-broker interface, and I have now deployed an updated server snapshot config (0.2.0-SNAPSHOT) to the Sonatype repo to simplify the problem of running the server outside an IDE.

Here's how you can download and run the server, and try out the broker. This procedure will run the server with maven, and the broker with Eclipse/STS:

  • Clone powertac-server from git@github.com:powertac/powertac-server.git in a new directory. Go to powertac-server/server-distribution and run 'mvn exec:exec -Dexec.args="config/bootstrap.txt" to pull down all the server components and generate a new bootstrap-data file. This should take about 10 minutes. You need this because there are a couple of format changes and your old bootstrap data file will not work.
  • Clone the sample-broker project from git@github.com:powertac/sample-broker.git, and import it into STS. It should find its dependency on common from the maven repo, but if you want to look at the code it depends on, you will also need to pull down the latest version of common as well. It does not depend on any server components.
  • If you want to save the logfiles from the bootstrap session, you need to rename them now, because they will be overwritten by the following sim session.
  • Back in server-distribution, run 'mvn exec:exec -Dexec.args="config/sim-sample.txt"' to start the server in sim mode and wait for a login from the sample broker, whose default username is "Sample".
  • In STS, create a run configuration as an AspectJ/Java app, with Project = sample-broker and Main class = org.powertac.samplebroker.BrokerMain. You don't need any arguments, but it does take a command-line arg to specify the username and complains if you don't give one. You can safely ignore this complaint. Run it.

At this point, I have only tried it running both the broker and server on localhost. I leave it as an exercise for someone with more free time than I have to get them running on separate machines.

Please let me know how this works for you.

John

Reply | Threaded
Open this post in threaded view
|

Re: Announcement: Java-based sample broker implementation available

Bart Ariens
Dear John and all,

I followed each step you described. I just removed all the existing powertac files and did a new clone of the latest powertac server. I created a new bootstrap file successfully and changed the pom.xml file so the sample-broker is now recognized as a component of the server. What I did do different though is instead of running the server-distribution, I ran the server-main with the sim-sample.txt argument (and it seems to work since it is waiting for sample-broker)

However, I encountered 2 errors:

1. I can't find BrokerMain in the sample-broker directory, actually there are no main classes at all...
2. I get an error in the SampleBrokerTest.java (Description Resource Path Location Type
The method getBroker() is undefined for the type BrokerAuthentication SampleBrokerTest.java /sample-broker/src/test/java/org/powertac/samplebroker line 91 Java Problem)

i've sent a screenshot of STS

http://uploadpic.org/v.php?img=NG7ZBfMlNo


I hope someone can help,

thanks,

bart




Reply | Threaded
Open this post in threaded view
|

Re: Announcement: Java-based sample broker implementation available

grampajohn
Administrator
Bart Ariens wrote
...
However, I encountered 2 errors:

1. I can't find BrokerMain in the sample-broker directory, actually there are no main classes at all...
2. I get an error in the SampleBrokerTest.java (Description Resource Path Location Type
The method getBroker() is undefined for the type BrokerAuthentication SampleBrokerTest.java /sample-broker/src/test/java/org/powertac/samplebroker line 91 Java Problem)
The sample broker that's on the "master" branch is a remote broker; it will not work as a Spring module inside the server.  The main() function is in BrokerMain. There is another version in the "local-master" branch, but it's not quite correct, and I'm working to figure out how to make the master codebase work both locally (as a server component) and remotely.

Does this help?

John
Reply | Threaded
Open this post in threaded view
|

Re: Announcement: Java-based sample broker implementation available

grampajohn
Administrator
grampajohn wrote
The sample broker that's on the "master" branch is a remote broker; it will not work as a Spring module inside the server.  The main() function is in BrokerMain. There is another version in the "local-master" branch, but it's not quite correct, and I'm working to figure out how to make the master codebase work both locally (as a server component) and remotely.
I can see now why you were confused. BrokerMain is indeed where the main() function resides, but it seems not to have been added to git. I'll attend to that when I'm back home later today.

John

Reply | Threaded
Open this post in threaded view
|

Re: Announcement: Java-based sample broker implementation available

grampajohn
Administrator
It should be good. I had the local version on the component-master branch, and the remote version on the remote-master branch. Then I merged remote-master into master and made some changes, but never pushed it. It's there now.

Sorry for the confusion.

John
Reply | Threaded
Open this post in threaded view
|

Re: Announcement: Java-based sample broker implementation available

Bart Ariens
thank you so much! it is working now!