remove separate implementation of job api from coordinator
This commit is contained in:
@@ -118,28 +118,10 @@ async fn test_01_flow_create_simple() {
|
||||
|
||||
let client = create_client().await;
|
||||
|
||||
// Create jobs for the flow
|
||||
// Note: Jobs should be created by the supervisor, not the coordinator
|
||||
// For this test, we'll create a flow with job IDs that may not exist yet
|
||||
// In a real scenario, jobs would be created by the supervisor first
|
||||
let job_ids = vec![BASE_JOB_ID, BASE_JOB_ID + 1];
|
||||
for (i, job_id) in job_ids.iter().enumerate() {
|
||||
let job = JobCreate {
|
||||
id: *job_id,
|
||||
caller_id: TEST_CALLER_ID,
|
||||
context_id: TEST_CONTEXT_ID,
|
||||
script: format!("print('job {}')", i),
|
||||
script_type: ScriptType::Python,
|
||||
timeout: 60,
|
||||
retries: 0,
|
||||
env_vars: HashMap::new(),
|
||||
prerequisites: vec![],
|
||||
depends: if i == 0 { vec![] } else { vec![job_ids[i - 1]] },
|
||||
};
|
||||
|
||||
let result = client.job_create_or_load(TEST_CONTEXT_ID, job).await;
|
||||
if let Err(ref e) = result {
|
||||
println!(" Job {} creation error: {:?}", job_id, e);
|
||||
}
|
||||
assert!(result.is_ok(), "Job {} should be created", job_id);
|
||||
}
|
||||
|
||||
// Create flow
|
||||
let flow_create = FlowCreate {
|
||||
@@ -171,21 +153,6 @@ async fn test_02_flow_load() {
|
||||
|
||||
// Create a flow first (reuse from test_01)
|
||||
let job_ids = vec![BASE_JOB_ID, BASE_JOB_ID + 1];
|
||||
for (i, job_id) in job_ids.iter().enumerate() {
|
||||
let job = JobCreate {
|
||||
id: *job_id,
|
||||
caller_id: TEST_CALLER_ID,
|
||||
context_id: TEST_CONTEXT_ID,
|
||||
script: format!("print('job {}')", i),
|
||||
script_type: ScriptType::Python,
|
||||
timeout: 60,
|
||||
retries: 0,
|
||||
env_vars: HashMap::new(),
|
||||
prerequisites: vec![],
|
||||
depends: if i == 0 { vec![] } else { vec![job_ids[i - 1]] },
|
||||
};
|
||||
let _ = client.job_create_or_load(TEST_CONTEXT_ID, job).await;
|
||||
}
|
||||
|
||||
let flow_create = FlowCreate {
|
||||
id: TEST_FLOW_ID,
|
||||
@@ -216,23 +183,8 @@ async fn test_03_flow_dag() {
|
||||
|
||||
let client = create_client().await;
|
||||
|
||||
// Create jobs with dependencies
|
||||
// Note: Jobs should be created by the supervisor
|
||||
let job_ids = vec![BASE_JOB_ID + 100, BASE_JOB_ID + 101, BASE_JOB_ID + 102];
|
||||
for (i, job_id) in job_ids.iter().enumerate() {
|
||||
let job = JobCreate {
|
||||
id: *job_id,
|
||||
caller_id: TEST_CALLER_ID,
|
||||
context_id: TEST_CONTEXT_ID,
|
||||
script: format!("print('dag job {}')", i),
|
||||
script_type: ScriptType::Python,
|
||||
timeout: 60,
|
||||
retries: 0,
|
||||
env_vars: HashMap::new(),
|
||||
prerequisites: vec![],
|
||||
depends: if i == 0 { vec![] } else { vec![job_ids[i - 1]] },
|
||||
};
|
||||
let _ = client.job_create_or_load(TEST_CONTEXT_ID, job).await;
|
||||
}
|
||||
|
||||
let flow_id = TEST_FLOW_ID + 1;
|
||||
let flow_create = FlowCreate {
|
||||
@@ -268,19 +220,6 @@ async fn test_04_flow_start() {
|
||||
|
||||
// Create a simple flow
|
||||
let job_id = BASE_JOB_ID + 200;
|
||||
let job = JobCreate {
|
||||
id: job_id,
|
||||
caller_id: TEST_CALLER_ID,
|
||||
context_id: TEST_CONTEXT_ID,
|
||||
script: "print('start test')".to_string(),
|
||||
script_type: ScriptType::Python,
|
||||
timeout: 60,
|
||||
retries: 0,
|
||||
env_vars: HashMap::new(),
|
||||
prerequisites: vec![],
|
||||
depends: vec![],
|
||||
};
|
||||
let _ = client.job_create_or_load(TEST_CONTEXT_ID, job).await;
|
||||
|
||||
let flow_id = TEST_FLOW_ID + 2;
|
||||
let flow_create = FlowCreate {
|
||||
|
||||
Reference in New Issue
Block a user