Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/RestServer/TaskRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,12 @@ public ResponseEntity<Map<String, Object>> get_task_result_mongo() {
public ResponseEntity<Map<String, Object>> get_task_result() {
Map<String, Object> body = new HashMap<>();
WorkLoadGenerate task = TaskRequest.loader_tasks.get(this.taskName);
System.out.println("[DEBUG] get_task_result called for task: " + this.taskName);
System.out.println("[DEBUG] Task exists: " + (task != null));
if (task != null) {
Map<String, Object> failures = new HashMap<>();
boolean okay = TaskRequest.taskManager.getTaskResult(task);
System.out.println("[DEBUG] TaskManager.getTaskResult returned: " + okay);
TaskRequest.loader_tasks.remove(this.taskName);
for (HashMap.Entry<String, List<Result>> optype : task.failedMutations.entrySet()) {
optype.getValue().forEach(
Expand All @@ -567,10 +570,13 @@ public ResponseEntity<Map<String, Object>> get_task_result() {
}
body.put("fail", failures);
body.put("status", okay);
System.out.println("[DEBUG] Returning body with status: " + okay + ", fail dict: " + failures);
} else {
body.put("error", "Task " + this.taskName + " does not exists");
body.put("status", false);
System.out.println("[DEBUG] Task " + this.taskName + " does not exist");
}
System.out.println("[DEBUG] Final body: " + body);
return new ResponseEntity<>(body, HttpStatus.OK);
}

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/couchbase/loadgen/WorkLoadGenerate.java
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@ public void run() {
if (this.sdkClientPool != null)
this.sdk = this.sdkClientPool.get_client_for_bucket(
this.bucket_name, this.scope, this.collection);
// If SDK client is null, mark task as failed and return
if (this.sdk == null) {
this.result = false;
return;
}
try {
this.actual_run();
}
Expand Down