Skip to content

Commit

Permalink
Rename invoker -> judge
Browse files Browse the repository at this point in the history
  • Loading branch information
MikailBag committed Sep 4, 2020
1 parent 7441e1e commit 688b94e
Show file tree
Hide file tree
Showing 39 changed files with 159 additions and 162 deletions.
92 changes: 46 additions & 46 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ opt-level = 0
[workspace]
# TODO: add other as they are fixed
members=[ "src/devtool", "src/gen-api-client", "src/cli", "src/client",
"src/problem-loader", "src/invoker", "src/dist-files-generator",
"src/dist-builder", "src/svaluer", "src/invoker-api", "src/pps/api",
"src/problem-loader", "src/judge", "src/dist-files-generator",
"src/dist-builder", "src/svaluer", "src/judging-apis", "src/pps/api",
"src/pps/cli", "src/pps/server" ]
30 changes: 15 additions & 15 deletions k8s/jjs/templates/invoker.yaml → k8s/jjs/templates/judge.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: invoker
name: judge
rules:
- apiGroups: [""]
resources: ["configmaps"]
Expand All @@ -10,27 +10,27 @@ rules:
apiVersion: v1
kind: ServiceAccount
metadata:
name: invoker
name: judge
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: invoker
name: judge
subjects:
- kind: ServiceAccount
name: invoker
name: judge
apiGroup: ""
roleRef:
kind: Role
name: invoker
name: judge
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: invoker
name: judge
labels:
app: invoker
app: judge
# {{- if .Values.dev.kubeScore }}
annotations:
kube-score/ignore: container-security-context
Expand All @@ -39,21 +39,21 @@ spec:
replicas: 1
selector:
matchLabels:
app: invoker
app: judge
template:
metadata:
labels:
app: invoker
app: judge
spec:
serviceAccountName: invoker
serviceAccountName: judge
containers:
- name: invoker
- name: judge
env:
- name: RUST_LOG
value: info,invoker=trace,problem_loader=trace,puller=trace
value: info,judger=trace,problem_loader=trace,puller=trace
- name: JJS_AUTH_DATA_INLINE
value: '{"endpoint": "http://apiserver:1779/", "auth": {"byToken": {"token": "Dev::root"}}}'
image: "{{ .Values.image.repositoryPrefix }}invoker:{{ .Values.image.tag }}"
image: "{{ .Values.image.repositoryPrefix }}judge:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
privileged: true
Expand All @@ -69,7 +69,7 @@ spec:
apiVersion: v1
kind: Service
metadata:
name: invoker
name: judge
spec:
type: ClusterIP
ports:
Expand All @@ -78,4 +78,4 @@ spec:
protocol: TCP
name: http
selector:
app: invoker
app: judge
4 changes: 2 additions & 2 deletions k8s/jjs/templates/network-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ spec:
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: builtin-invoker
name: builtin-judge
spec:
podSelector:
matchLabels:
app: invoker
app: judge
policyTypes:
- Ingress
ingress: []
Expand Down
2 changes: 1 addition & 1 deletion src/dist-builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ fn make_rust_package_list() -> Vec<RustPackage> {
add("pps-cli", "jjs-pps", Section::Tool);
//add("userlist", "jjs-userlist", Section::Tool);
add("cli", "jjs-cli", Section::Tool);
add("invoker", "jjs-invoker", Section::Daemon);
add("judge", "jjs-judge", Section::Daemon);
add("svaluer", "jjs-svaluer", Section::Tool);
/*add(
"configure-toolchains",
Expand Down
4 changes: 2 additions & 2 deletions src/invoker/Cargo.toml → src/judge/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

[package]
name = "invoker"
name = "judge"
version = "0.1.0"
authors = ["Mikail Bagishov <[email protected]>"]
edition = "2018"
Expand All @@ -11,7 +11,7 @@ serde = { version = "1.0.115", features = ["derive"] }
serde_json = "1.0.57"
dotenv = "0.15.0"
aho-corasick = "0.7.13"
invoker-api = {path = "../invoker-api"}
judging-apis = {path = "../judging-apis"}
pom = {path = "../pom"}
libc = "0.2.76"
nix = "0.18.0"
Expand Down
4 changes: 2 additions & 2 deletions src/invoker/Dockerfile → src/judge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates
ENV JJS_DATA=/data
ENV JJS_AUTH_DATA=/auth/authdata.yaml
ENV RUST_BACKTRACE=1
COPY jjs-invoker /bin/jjs-invoker
ENTRYPOINT ["jjs-invoker"]
COPY jjs-judge /bin/jjs-judge
ENTRYPOINT ["jjs-judge"]
File renamed without changes.
2 changes: 1 addition & 1 deletion src/invoker/src/config.rs → src/judge/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, Debug)]
#[serde(deny_unknown_fields)]
#[serde(rename_all = "kebab-case")]
pub struct InvokerConfig {
pub struct JudgeConfig {
/// How many workers should be spawned
/// By default equal to processor count
#[serde(default)]
Expand Down
10 changes: 5 additions & 5 deletions src/invoker/src/controller.rs → src/judge/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub enum InvocationFinishReason {
/// Contains both judging task and back address.
/// Each task source is represented as mpsc channel of `TaskInfo`s
pub struct JudgeRequestAndCallbacks {
pub request: invoker_api::JudgeRequest,
pub request: judging_apis::JudgeRequest,
pub callbacks: Arc<dyn JudgeResponseCallbacks>,
}

Expand All @@ -62,13 +62,13 @@ pub trait JudgeResponseCallbacks: Send + Sync {
async fn add_outcome_header(
&self,
invocation_id: Uuid,
header: invoker_api::JudgeOutcomeHeader,
header: judging_apis::JudgeOutcomeHeader,
) -> anyhow::Result<()>;

async fn deliver_live_status_update(
&self,
invocation_id: Uuid,
lsu: invoker_api::LiveStatusUpdate,
lsu: judging_apis::LiveStatusUpdate,
) -> anyhow::Result<()>;
}

Expand All @@ -77,7 +77,7 @@ pub struct Controller {
scheduler: Arc<Scheduler>,
problem_loader: Arc<problem_loader::Loader>,
toolchains_dir: Arc<Path>,
_config: Arc<crate::config::InvokerConfig>,
_config: Arc<crate::config::JudgeConfig>,
// used as RAII resource owner
_temp_dir: Arc<tempfile::TempDir>,
toolchain_loader: Arc<toolchains::ToolchainLoader>,
Expand All @@ -98,7 +98,7 @@ fn get_num_cpus() -> usize {
impl Controller {
pub async fn new(
cfg_data: util::cfg::CfgData,
config: Arc<crate::config::InvokerConfig>,
config: Arc<crate::config::JudgeConfig>,
) -> anyhow::Result<Controller> {
let worker_count = match config.workers {
Some(cnt) => cnt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl Notifier {

#[instrument(skip(self), fields(judge_request_id=%self.judge_request_id))]
async fn drain(&mut self) {
let event = invoker_api::LiveStatusUpdate {
let event = judging_apis::LiveStatusUpdate {
score: self.score.take().map(|x| x as i32),
current_test: self.test.take(),
};
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 688b94e

Please sign in to comment.