Skip to content

Commit

Permalink
Implemented file locations for standard jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Jul 10, 2023
1 parent 9e4ba3b commit cc27fc8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
6 changes: 1 addition & 5 deletions tools/wrench/wrench-daemon/doc/wrench-openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -408,16 +408,12 @@
}
],
"requestBody": {
"description": "Job characteristics.",
"description": "Input file.",
"required": true,
"content": {
"application/json": {
"schema": {
"properties": {
"task": {
"type": "string",
"description": "The task's ID"
},
"file": {
"type": "string",
"description": "The file's ID"
Expand Down
14 changes: 12 additions & 2 deletions tools/wrench/wrench-daemon/src/SimulationController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,17 @@ namespace wrench {
tasks.push_back(this->workflow->getTaskByID(name));
}

auto job = this->job_manager->createStandardJob(tasks);
std::map<std::shared_ptr<DataFile>, std::shared_ptr<FileLocation>> file_locations;
for (auto it = data["file_locations"].begin(); it != data["file_locations"].end(); ++it)
{
auto file = this->workflow->getFileByID(it.key());
std::shared_ptr<StorageService> storage_service;
this->storage_service_registry.lookup(it.value(), storage_service);
file_locations[file] = FileLocation::LOCATION(storage_service, file);
}


auto job = this->job_manager->createStandardJob(tasks, file_locations);
this->job_registry.insert(job->getName(), job);
json answer;
answer["job_name"] = job->getName();
Expand Down Expand Up @@ -743,7 +753,7 @@ namespace wrench {
* @return JSON output
*/
json SimulationController::addInputFile(json data) {
auto task = this->workflow->getTaskByID(data["task"]);
auto task = this->workflow->getTaskByID(data["tid"]);
auto file = this->workflow->getFileByID(data["file"]);
task->addInputFile(file);
return {};
Expand Down

0 comments on commit cc27fc8

Please sign in to comment.