hex539 / scoreboard

Online judge scoreboard parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need Document

cjc7373 opened this issue · comments

Please provide more detailed document, cause i am not very familiar with java.

What are you trying to do that you want documentation on?

I want to use it to show Animated reveal of final contest results from domjudge.
And I want to know how.
For now I just cannot compile the project.

C:\Users\niuch\Downloads\domjudge\scoreboard-master>bazel build scoreboards/console
INFO: Invocation ID: b617764c-f89b-4634-87de-07b190be1fe1
ERROR: error loading package '': Encountered error while reading extension file 'rules.bzl': no such package '@parboiled_java//': no such package '@gradle_distribution//': The native new_http_archive rule is deprecated. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.
ERROR: error loading package '': Encountered error while reading extension file 'rules.bzl': no such package '@parboiled_java//': no such package '@gradle_distribution//': The native new_http_archive rule is deprecated. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.
INFO: Elapsed time: 0.352s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
    Fetching @parboiled_java; Restarting.
    Fetching @gradle_distribution; fetching

Thank you.

Thanks for the detailed log. The error you got is because the repo was broken by Bazel 0.21 removing new_http_archive and git_repository rules -- this is my fault, I stuck with the old version too long. Sync again, it will be fixed by commit fa05ea9

Once it's working you have two commands you can run to try things out:

$ bazel run scoreboards/console -- --url=https://domjudge.bath.ac.uk resolver
$ bazel run scoreboards/resolver -- --url=https://domjudge.bath.ac.uk

The first one will just give you a text-mode resolution in the terminal to make sure things are working properly and you can access the API. The second one will open a window which you can move forward in with arrow keys or SPACE, or quit with ESC.

You can pass in --username=$xyz and --password=$xyz options to log in as a user with event_feed access to get the final verdicts if the contest is still frozen.

If for any reason it turns out this doesn't work with your server can you let me know which version of DOMjudge you're running? (and preferably also the public URL if there is one)

The first command worked.
But the second command didn't work and have the following log.

test@test-virtual-machine:~/scoreboard$ bazel run scoreboards/resolver -- --url=http://172.18.13.16
INFO: Invocation ID: 345351f2-db14-4e97-88fb-fd21a343c2ee
INFO: Analysed target //scoreboards/resolver:resolver (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //scoreboards/resolver:resolver up-to-date:
  bazel-bin/scoreboards/resolver/resolver.jar
  bazel-bin/scoreboards/resolver/resolver
INFO: Elapsed time: 0.553s, Critical Path: 0.01s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/scoreboards/resolver/resolver '--url=http:INFO: Build completed successfully, 1 total action
Hit http://172.18.13.16/api/categories
Hit http://172.18.13.16/api/v3/categories
Fetching http://172.18.13.16/api/v3/contest...
Fetching http://172.18.13.16/api/v3/affiliations...
Fetching http://172.18.13.16/api/v3/categories...
Fetching http://172.18.13.16/api/v3/clarifications...
Fetching http://172.18.13.16/api/v3/contests...
Fetching http://172.18.13.16/api/v3/judgement_types...
Fetching http://172.18.13.16/api/v3/problems?cid=7...
Fetching http://172.18.13.16/api/v3/scoreboard?cid=7...
Fetching http://172.18.13.16/api/v3/submissions?cid=7...
Fetching http://172.18.13.16/api/v3/teams...
Fetching http://172.18.13.16/api/v3/judgings?cid=7...
Scoreboard is not sorted increasing by rank.
Team 45 has index 35 but rank 35
Scoreboard is not sorted increasing by rank.
Team 20 has index 35 but rank 35
Scoreboard is not sorted increasing by rank.
Team 26 has index 35 but rank 35
Scoreboard is not sorted increasing by rank.
Team 43 has index 35 but rank 35
Scoreboard is not sorted increasing by rank.
Team 42 has index 35 but rank 35
Scoreboard is not sorted increasing by rank.
Team 2 has index 35 but rank 35
Scoreboard is not sorted increasing by rank.
Team 3 has index 35 but rank 35
Scoreboard is not sorted increasing by rank.
Team 4 has index 35 but rank 35
Scoreboard is not sorted increasing by rank.
Team 5 has index 35 but rank 35
Scoreboard is not sorted increasing by rank.
Team 6 has index 35 but rank 35
Scoreboard is not sorted increasing by rank.
Team 7 has index 35 but rank 35
Scoreboard is not sorted increasing by rank.
Team 49 has index 35 but rank 35
Scoreboard is not sorted increasing by rank.
Team 47 has index 35 but rank 35
Exception in thread "main" java.util.NoSuchElementException: Organization '0'
	at me.hex539.contest.ScoreboardModelImpl.getOrganization(ScoreboardModelImpl.java:247)
	at me.hex539.resolver.Renderer.drawLabel(Renderer.java:251)
	at me.hex539.resolver.Renderer.drawRow(Renderer.java:200)
	at me.hex539.resolver.Renderer.mainLoop(Renderer.java:176)
	at me.hex539.resolver.ResolverWindow.run(ResolverWindow.java:82)
	at me.hex539.resolver.Executive.main(Executive.java:56)

I am using DOMjudge 6.0.3(The latest stable release).And because it's in a intranet, i probably can't provide the public URL.

Something must be off in the API then: it looks like your teams have an organisation of "0" in /api/contests//teams but that organisation doesn't actually exist in the /api/contests//organizations DOMjudge is returning. This is not supposed to happen...

Commit e57ee73 has a temporary fix for this if you want to pull and try it again. Do you have teams set up in groups/institutions/organizations at all?

Ah, I see the reason for the "0"s: it's incorrectly detecting the CLICS api as not available and falling back to DOMjudge's old API, perhaps because the contest doesn't have a duration. The organizationId gets mangled from null to "0" along the way.

Anyway, that should work now.

Commit e57ee73 and eaae6ca worked.Thanks!
And I think Organization '0' is because I haven't set up team's organization.
However, commit e3e31e1 failed again.Error log following.

test@test-virtual-machine:~/scoreboard$ bazel run scoreboards/resolver -- --url=http://172.18.13.16
INFO: Invocation ID: 5979e64a-5c2d-4d6d-b3db-cd7f2e1b4a83
INFO: Analysed target //scoreboards/resolver:resolver (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //scoreboards/resolver:resolver up-to-date:
  bazel-bin/scoreboards/resolver/resolver.jar
  bazel-bin/scoreboards/resolver/resolver
INFO: Elapsed time: 2.135s, Critical Path: 1.90s
INFO: 4 processes: 2 linux-sandbox, 2 worker.
INFO: Build completed successfully, 5 total actions
INFO: Running command line: bazel-bin/scoreboards/resolver/resolver '--url=http:INFO: Build completed successfully, 5 total actions
Hit http://172.18.13.16/api/v3/categories
Hit http://172.18.13.16/api/categories
Fetching http://172.18.13.16/api/v3/contest...
Fetching http://172.18.13.16/api/v3/affiliations...
Fetching http://172.18.13.16/api/v3/categories...
Fetching http://172.18.13.16/api/v3/clarifications...
Fetching http://172.18.13.16/api/v3/judgement_types...
Fetching http://172.18.13.16/api/v3/contests...
Fetching http://172.18.13.16/api/v3/problems?cid=7...
Fetching http://172.18.13.16/api/v3/scoreboard?cid=7...
Fetching http://172.18.13.16/api/v3/submissions?cid=7...
Fetching http://172.18.13.16/api/v3/teams...
Fetching http://172.18.13.16/api/v3/judgings?cid=7...
Exception in thread "main" java.lang.NullPointerException
	at edu.clics.proto.ClicsProto$Team$Builder.setOrganizationId(ClicsProto.java:15005)
	at me.hex539.interop.ContestConverters.toClics(ContestConverters.java:149)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at me.hex539.interop.ContestConverters.map(ContestConverters.java:19)
	at me.hex539.interop.ContestConverters.toClics(ContestConverters.java:43)
	at me.hex539.contest.ContestDownloader.fetch(ContestDownloader.java:58)
	at me.hex539.resolver.Executive.main(Executive.java:39)

Another question: I noticed the resolver fetching data with old v3 API, but my DOMjudge version clearly supports new API. Maybe there is a problem with the detecting part?

However, commit e3e31e1 failed again.Error log following.

👍 I'm going to revert that and rewrite everything in the old API instead of trying to patch it then.

Maybe there is a problem with the detecting part?

Yes. It's not actually finding the URL for the new API (you can see "Hit http://172.18.13.16/api/v3/categories" and
"Hit http://172.18.13.16/api/categories" but it didn't get a 200 response for any of the other endpoints it tried, like //api/contests).

What is the location of this API on the server? https://www.domjudge.org/demoweb/api/contests (edit: note the fact it's in an array and has a formal_name field, which shows it's the /contests endpoint for the new API instead of for the old one)