config generation script #37
Labels
No Label
bug
component
executor
component
framework
component
parser
component
UI
duplicate
enhancement
help wanted
invalid
priority
p0
priority
p1
priority
p2
priority
p3
question
wontfix
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: JOJ/JOJ3#37
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal: a script to generate joj config files
requirements:
conf.toml
specs and detail them in a wiki pageconf.toml
file (could be interactive, eg. prompting for the score of a task, amount on memory, etc.)note: the script could be 2 scripts, as import should occur once while generating a
conf.toml
might happen more often...created repo at FOCS/joj-config-generator
since I'm not an administrator I can't create repo under FOCS-dev :(
back to focs-dev :-)
this time it's me that have no permissions 🤯
which repo should we edit the wiki page in? @manuel
sorry had forgotten to add repo to joj team... now fixed
write toml spec doc on joj repo, this is where it belongs. user doc can be in a readme in script repo
toml specs in FOCS-dev/JOJ3, toml generator docs in our repo @jon-lee
@manuel
I have several questions:
healthcheck
run
compile
do we have?Makefile
anddockerfile
in therunner-image
of remote server, but I only find:so what is the current situation of remote server?
fully dacument the specifications of the files, ie
\to
this is for develiopment purposethis is a different issue. this issue is about generating a
conf.toml
filenot sure what you ask, but this is irrelevant to this issue. here you're simply supposed to write code to generate a valid
conf.toml
file. check the sample you'll notice patterns, common parts, etc.identify what parts should be filled in by the user (eg. asking questions or providing cli arguments) and generate a file.
I guess it is done in
demo.yaml
file by fetching all the code for one line?like
@manuel :[
I think I need to know more about whether it is flexible? the things I want to be clarified is that: every time a homework/project pushed to the repo, joj will check all of the stages one by one, and use parser, if one homework is missing, give 0. So its like giving score to the code of the whole repo? Things bit change from last year according to my memory.
If so, things easier to handle.
no, grading is handled by
go-judge
andjoj3
basically what TA needs to do is to determine the stages for
joj3
to run, e.g. first compile, then healthcheck, then send togo-judge
, during the process memory and cpu time is limited, etc. so a tool is needed to simplify TA's work, such that they don't need to write toml themselves, instead they inputthen we generate
There is no need to change the content of demo.yaml. It just checkouts the repo and runs two commands.
you can check JOJ3-actions-examples to see what is
joj3
doingwhat I am docing right now is giving interpretation to
like things
OK, I will take a more close look.
Sandbox executor always sends to go-judge. Stages run one by one. Each stage contains an executor that runs command and give the command output, and a parser that parse the output and generate score and comment.
@nuvole check toml file format specs, this will be helpful to undertsand you to interpret the file content
OK, it seems my previous understanding is right, so what I need to doc now is to write the format for specifically things in
conf.toml
yes
@manuel @bomingzh what is the current situation of runner-image? guess we have switched our strategy, using action binary?
i don't understand the question
so previously, as @zzjc123 mentioned to me that we may have makefile and dockerfile on the
runner-image
folder of the server. But now we havewhat have we changed? and is that matter to the change of
runner-image
? I think I need to know more detail about what happens on the server.and also, about the
dummy
andkeyword
parser.it is outdated workflow now I think.
yes, so what should be the current workflow
Everything is run inside a container through Gitea actions.
runner-image
is a repo used to build the image for that container. I do not think anything insidett@joj-test1
will affect any future work. The working config is intt@engr151-24fa
, nottt@joj-test1
.i don't think config file generation has anything to do with "where" or "how" things are run.
you should simply write a short script with can interactively ask for info or read it from a file (eg. what language do you use? (then display available choices) or read
LANG=c++
from a file).for reading from a file, an
env
file or toml file could both be acceptable i guess? @bomingzh did you have any specific format in mind?overall the goal of this script/issue is to prepare a config file for JOJ to be able to run. How it will run is in "another layer". so assume all software are correctly installed. Your output file (JOJ toml config) will be parsed and tasks run based on its content. You don't need to worry about anything else :-)
OK, so here is what I planed to do: write two scripts, one for matlab and one for C and C++
where we use
healthcheck
parser forhealthcheck
stage, anddiff
parser for the run stage.where we have
healthcheck
parser forhealthcheck
stage,clang-tidy
,cpplint
,cppcheck
forcode-check
stage,result-status
forcompile
stage,diff
forrun
stageanything to add or anything wrong? @manuel @bomingzh
JOJ3 currently use https://github.com/koding/multiconfig with no limitation, so according to the docs,
The script should output any of these formats. If we need to migrate from JOJ1, then the input file format should be yaml.
No! Your script must be generic and apply to any case. some assignment could even have more than 1 language.
this script will be used in all JI courses using JOJ, not only in 151.
so you script could ask for what plugins will be needed (code quality (which tools), compilation "requirements", language, etc.) then generate a
conf.toml
which is suitable for the assignment.the script should cover all possible combinations (eg. FOCS-dev/JOJ3#14 (comment))
@bomingzh
how similar are joj1 1and joj3 config files? (in term of fields/features compatibility)? is it best to "import JOJ1" and "fix it" or start from scratch with a new config?
maybe the judging part can be imported and the rest generated from scratch? (JOJ1 had no code quality or repo health feature/config)
i guess we would still need a "creating from scratch" option as news courses/assignments might appear? (maybe can be a feature for later as for now courses mostly need import (aside of 477 latex compilation))
@manuel
It should be similar. The core parts are
JOJ1:
JOJ3:
another question: for each homework for example, do we have only one
toml
file or multipletoml
files for each of the exercise?and how do we ensure that, only one stage for healthcheck for all if for multiple files case?
the initial idea was:
seems our toml is now a bit complicated, so we need to auto-generate it. we might want to think about it and see if json would not be better. but for now we can go with toml (unless switch is easy/fast). toml is nice for human editing and more "friendly" than yaml.
for judge part we can have a default toml or env config setup (eg. fixed score, time, mem), then it can be easily edited by TAs if needed. this initial high level simple file is then parsed by the generating script in order to get the "real" config file for the assignment. it would make sense that this "computer friendly" config file in one piece.
the high level config file could for instance simply list exercises that can be tested on JOJ (this is what we had last fall), it looked like
if you take
h1
it feature the JOJ1 id for each exercise (-1
) means not available to test on JOJ, and last element of the line specifies the language.this type of thing is easy to write for a human in an
env
ortoml
file. withtoml
we can be a bit more specific for each execise: either we provide mem/time limitations or default ones are applied. we could also specify what test cases apply to what exercise, etc.in the end we would get a single long/complex generated file pr hw (computer firiendly) while keeping basic config easy to handle for humans. this script is the bridge between the 2
@bomingzh is it what you also had in mind?
For JOJ3, switch between yaml, toml, json is very easy.
Agree. In the simplest case, let the script user only provide the compile command and run command, then the script should fill all the other values by default (1s, 32MB, 10 points), and detect all the cases input and output in a dir.
ok then lets do it now, otherwise we'll have to redo some work later...
TAs could only push that simple file, then config file generating would happen on the server (and pushed back to repo). so no need to install python packages or anything on their local computer
What's current strategy for config? One config per hw or one config per question?
afaik it's one per question
we will have config files named
h1-ex1
,h1-ex2
, etc.If it is the case, we need h1-ex1-hc h1-ex1-cq h1-ex1-oj currently
i guess no need for -cq and -oj? if your commit msg parser can figure out what to do
What do you mean? For now commit msg parser just decide which config to read.
https://focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3/src/branch/commit-parser/cmd/joj3/conf.go
okay, i will look into your parser later to figure out what we should do :)
I think we might be able to fix everything if we use one config for each hw. (one config for each ex is also fine) without changing the mainImpl
e.g.
https://focs.ji.sjtu.edu.cn/git/FOCS-dev/JOJ3-examples/src/branch/diff/complex/conf.json
if we write in the following pattern then multiple exercise is possible to implement.
The issue is that if we just brutally run all stages in sequence, the code in previous exercise might have side effect on the other exercise. So in this case:
mainImpl
finally andWhat is the advantage of using fewer config files?
I think we need to modify
main
s.t.conf
from config parserno idea, I write code for config per ex
As in JOJ1 and every other OJ, each exercise needs a submission. Why not do it in JOJ3?
We have this feature I think.
We can add a
pre_run
field inconf.json
for less duplication. The stages from thatpre_run
file should be added to the beginning of the current file.Now the first priority should be a full map from each keyword to a combination of types of config files needed, and see if a simple
pre_run
is enough.But will it be safer and reject strange bugs if we take this strategy? Students might submit multiple exercise at the same time I think
No, one commit, one exercise submission. They should not create that kind of commits.
got it.
We can even make a config file for config files. Just let JOJ3 read that meta config file. Then it can map any kind of commit messages to one real config.json. So for each course, they can have different types of commit message requirements. Like some courses in the future, only use gitea as OJ, then every commit can trigger compile+diff, dropping all the other parts.
for grading (eg. on a release) we want to have a JOJ score for teh whole hw.
joj: h3
should be able to run JOJ on all exercises from h3. every execise is graded individually and 1 JOJ commit per exercise is fine, but 1 commit per hw shold also be fine.we can however drop
joj: h3 4 7
(joj on h3 ex. 4 and 7) if you think this is not a good idea.Then we might need for some adjustment for following problem
We need to design new things to handle the whole hw JOJ score on release. It is not implemented and even considered in the current architecture.
We can trigger the run of JOJ3 of the whole homework on release using gitea actions. But now JOJ3 can not take the release name as an input.
generator script should check if
conf.yaml
file exists. if so then use it to import from joj1 config, otherwise generate a new file from conf.toml config file