Skip to content

Add JPLAG docker environment#1111

Closed
AlexandreDoneux wants to merge 3 commits into
INGInious:mainfrom
AlexandreDoneux:jplag_2
Closed

Add JPLAG docker environment#1111
AlexandreDoneux wants to merge 3 commits into
INGInious:mainfrom
AlexandreDoneux:jplag_2

Conversation

@AlexandreDoneux
Copy link
Copy Markdown
Contributor

This PR adds a JPLAG Docker environment for later implementation of JPLAG analyses as jobs. This environment takes a zip files containing directories containing files that will be compared by JPLAG. It decompresses it and runs the JPLAG jar.

JPLAG by default opens a GUI when run to display the results. Here, however, JPLAG only generates the compressed file (.jplag) that can be read afterwards with the same JPLAG jar. See JPLAG documentation

To use it outside the INGInious architecture you override the the INGInious script started by the container and replace it with a simple execution of the run script. The result file is saved on the container at /jplag/result/results.jplag. Run this docker command to run it. Here we have defined python3 as the language used for the plagiarism detection. A lot of languages are accepted (see documentation).

docker run  -v "$(pwd)/test_submissions.zip":/jplag/input/submissions.zip   
-e JPLAG_LANGUAGE=python3     
--entrypoint /bin/bash   
jplag:latest   
-c "python3 /course/run.py"

@codacy-production
Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 2 critical · 1 medium · 1 minor

Alerts:
⚠ 4 issues (≤ 0 issues of at least minor severity)

Results:
4 new issues

Category Results
Security 1 minor
2 critical
1 medium

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copy link
Copy Markdown
Member

@anthonygego anthonygego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this has to be considered finished or not. It is not clear whether you want to handle the container stack directly or pass through the agent code. In the latter case, I'd expect some input fetching code. The presence of a call to the feedback API in the snippets prvided is very confusing about how it is supposed to be used now and/or how it's going to evolve.

In all cases, I would keep this an external feature. Please migrate the internal JPlag plugin to the INGInious Github organization first on work on this repo.

The main repository should be later changed to allow these kinds of environment not to be advertised as grading environments.


LABEL org.opencontainers.image.source=https://github.com/INGInious/containers
LABEL org.opencontainers.image.description="Single test JPLAG job environment"
LABEL org.inginious.grading.name="jplag"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put in comment that we should replace/replace this in another PR because this kind of environment is not meant to be advertised as a grading environment. Maybe a opt-out "advertise" label can be a good implementation for this.

if not os.path.isfile(ZIP_PATH):
print(f"ERROR: submissions zip not found at '{ZIP_PATH}'.")
feedback.set_global_result("failed")
raise SystemExit(1)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what kind of LLM model you are using but it should be worth tweaking it or replacing it.

This is not idiomatic Python nor correct excception-driven development as, in the latter case, exceptions are made to be caught/handled.

This definition is used internally to kill the Python interpeter. You should use exit to do things properly.

Comment on lines +7 to +8
# docker run -v "$(pwd)/test_submissions.zip":/jplag/input/submissions.zip -e JPLAG_LANGUAGE=python3
# --entrypoint /bin/bash jplag:latest -c "python3 /course/run.py"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expected the code to run as a typical submission. In the case of a typical submission no volume is mounted, input is transferred via the agent internal messages. Mounting volumes on remote agents in not a bad idea on paper, but would require substantial changes in the agent code a it requires sharing the docker stack on the network.

If you want to support both, please add a decent documentation on how end users should use this, and/or provide a wrapper such as the ones in utils/scripts.

@AlexandreDoneux AlexandreDoneux marked this pull request as draft May 4, 2026 07:57
@AlexandreDoneux
Copy link
Copy Markdown
Contributor Author

As discussed, this PR was a way to show a first draft for the JPLAG environment. It was implemented in a way to test outside the INGInious architecture as it depends on this PR.

A new repository has been created to store the JLAG plugin outside the main architecture. I have moved the existing plugin and webserver from gitlb and moved all already existing code from this PR there.

@anthonygego
Copy link
Copy Markdown
Member

I'm closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants