metrics-db currently has (at least) six classes providing a main method, which are invoked using six corresponding ant tasks.
One solution for providing an executable jar:
Add a new class org.torproject.ernie.db.Main as the jar's main class adding the following functionality:
calling java -jar metrics-db.jar will show a usage message and exit.
calling java -jar metrics-db.jar <taskname> will run the main method of the class called in the current ant task of the same name, i.e., taskname is one of
bridgedescs
bridgepools
exitlists
relaydescs
torperf
updateindex
Finally, remove the then obsolete ant tasks from build.xml.
What is missing?
Should a task be added or removed?
Other thoughts?
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
I'd like to move over to a package hierarchy org.torproject.collector* and get rid of org.torproject.ernie* packages and classes. How about we use that new package structure for new classes like the new Main class you're thinking of? That could be org.torproject.collector.Main.
Can you also update the scripts in bin/* and call the new Main method with appropriate task name and ideally parameters like -Xmx2048m as in the current build.xml?
Other than that, nothing comes to mind that would be missing.
I'd like to move over to a package hierarchy org.torproject.collector* and get rid of org.torproject.ernie* packages and classes. How about we use that new package structure for new classes like the new Main class you're thinking of? That could be org.torproject.collector.Main.
org.torproject.collector.Main is fine. (also see #18727 (moved))
Can you also update the scripts in bin/* and call the new Main method with appropriate task name and ideally parameters like -Xmx2048m as in the current build.xml?
Discuss the following question from #18792 (moved) comment 3, by karsten:
Should the produced .jar file contain the required .jar files from lib/, except for example junit.jar? I don't remember the reasons for/against doing that in Onionoo and it might be that the answer is no for good reasons. And should we remove the compiled test classes? See Onionoo's build.xml where we're doing that.
Onionoo includes the classes from the required jars (cf. jar task)
(It is not possible to add jars inside a jar to the classpath. That's why we used zipgroupfileset in Onionoo.)
For CollecTor the jar collector.jar will also include the necessary classes.
Please find attached a patch implementing this task.
This could have also be achieved by using annotations, but as there will probably only one additional class with a main method, I decided to use a simpler approach. Only one added class (as outlined above) is necessary that way.
The shell scripts are changed accordingly and the jar ant task is extended to include all dependencies and the Main-Class property.
Looks good! Just one thing: Can you change <zipgroupfileset> to just include the libraries that are necessary for running CollecTor? Two reasons: the .jar file will be smaller and it won't contain classes from packages that are not in Debian stable. Other than that, ready to merge. Thanks!
Thanks for making that change. For some reason I'm unable to apply your patch using git am. Would you mind pushing your branch to your shiny new git.torproject.org repository?
In the future, consider pushing your changes to a separate task branch, like task-18719 (or whatever naming scheme you prefer). The downsides of using your master branch is that it may derive from the official master and that you can only have one change under review.
Closing this ticket as implemented. Thanks!
Trac: Status: merge_ready to closed Resolution: N/Ato implemented