Skip to content

Commit

Permalink
rename output dir for data join (bytedance#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
piiswrong authored Jul 21, 2020
1 parent 1bd5885 commit bd19d14
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions deploy/scripts/data_join/run_data_join_master.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export CUDA_VISIBLE_DEVICES=
source /app/deploy/scripts/hdfs_common.sh || true

python -m fedlearner.data_join.cmd.prepare_launch_data_join_cli \
--data_source_name=$DATA_SOURCE_NAME \
--data_source_name=$APPLICATION_ID \
--partition_num=$PARTITION_NUM \
--start_time=$START_TIME \
--end_time=$END_TIME \
Expand All @@ -38,4 +38,4 @@ python -m fedlearner.data_join.cmd.data_join_master_service \
--etcd_addrs=$ETCD_ADDR \
--etcd_base_dir=$ETCD_BASE_DIR \
--listen_port=50051 \
--data_source_name=$DATA_SOURCE_NAME
--data_source_name=$APPLICATION_ID
6 changes: 2 additions & 4 deletions web_console/tests/fixtures/test_data_join.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
fieldRef:
fieldPath: metadata.name
- name: ROLE
value: "Follower"
value: "follower"
- name: APPLICATION_ID
value: test_data_join
- name: OUTPUT_BASE_DIR
Expand All @@ -43,8 +43,6 @@ spec:
value: fedlearner-stack-ingress-nginx-controller.default.svc.cluster.local:80
- name: EGRESS_HOST
value: external.name
- name: DATA_SOURCE_NAME
value: test_data_join
- name: PARTITION_NUM
value: "2"
- name: START_TIME
Expand Down Expand Up @@ -98,7 +96,7 @@ spec:
fieldRef:
fieldPath: metadata.name
- name: ROLE
value: "Follower"
value: "follower"
- name: APPLICATION_ID
value: test_data_join
- name: OUTPUT_BASE_DIR
Expand Down
2 changes: 1 addition & 1 deletion web_console/tests/fixtures/test_data_portal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
- name: INPUT_BASE_DIR
value: /data/criteo_data/100wexamples
- name: OUTPUT_BASE_DIR
value: /data/data_portal_output/test_data_portal
value: /data/data_portal_output
- name: RAW_DATA_PUBLISH_DIR
value: portal_publish_dir/test_data_portal
- name: DATA_PORTAL_TYPE
Expand Down
3 changes: 1 addition & 2 deletions web_console/tests/utils/job_builder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ describe('portalGenerateYaml', () => {
name: 'test_data_portal',
output_partition_num: 2,
data_portal_type: 'Streaming',
input: 'criteo_data/100wexamples',
input: '/data/criteo_data/100wexamples',
output: '/data/portal_output', // TODO DEPRECATED for for shilei
context: {
file_wildcard: '*.rd',
Expand Down Expand Up @@ -421,7 +421,6 @@ describe('DataJoinGenerateYaml', () => {
spec: {
containers: [{
env: [
{ name: 'DATA_SOURCE_NAME', value: 'test_data_join' },
{ name: 'PARTITION_NUM', value: '2' },
{ name: 'START_TIME', value: '0' },
{ name: 'END_TIME', value: '999999999999' },
Expand Down
16 changes: 11 additions & 5 deletions web_console/utils/job_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ function generateYaml(federation, job, job_params, ticket) {
yaml = mergeJson(yaml, ticket.public_params);
yaml = mergeJson(yaml, ticket.private_params);

let output_base_dir;
if (job.job_type == 'data_join' || job.job_type == 'psi_data_join') {
output_base_dir = joinPath(
k8s_settings.storage_root_path, 'data_source', job.name);
} else {
output_base_dir = joinPath(
k8s_settings.storage_root_path, 'job_output', job.name);
}

const replica_specs = yaml.spec.flReplicaSpecs;
for (const key in replica_specs) {
let base_spec = {
Expand All @@ -142,10 +151,7 @@ function generateYaml(federation, job, job_params, ticket) {
{ name: 'POD_NAME', valueFrom: { fieldRef: { fieldPath: 'metadata.name' } } },
{ name: 'ROLE', value: ticket.role },
{ name: 'APPLICATION_ID', value: job.name },
{
name: 'OUTPUT_BASE_DIR',
value: joinPath(k8s_settings.storage_root_path, 'job_output', job.name)
},
{ name: 'OUTPUT_BASE_DIR', value: output_base_dir },
],
imagePullPolicy: 'IfNotPresent',
name: 'tensorflow',
Expand Down Expand Up @@ -206,11 +212,11 @@ function portalGenerateYaml(federation, raw_data) {
},
};
yaml = mergeJson(yaml, k8s_settings.global_job_spec);

yaml = mergeJson(yaml, raw_data.context.yaml_spec);

let master_spec = yaml.spec.flReplicaSpecs.Master;
master_spec = mergeJson(master_spec, k8s_settings.global_replica_spec);

master_spec = mergeJson(master_spec, {
pair: false,
replicas: 1,
Expand Down

0 comments on commit bd19d14

Please sign in to comment.