Skip to content

Commit

Permalink
refactor: use ProcessData structure in a more logic way
Browse files Browse the repository at this point in the history
  • Loading branch information
ereali-aneo committed Jul 16, 2024
1 parent 9f9dcde commit 8f0a714
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 25 deletions.
58 changes: 35 additions & 23 deletions src/TaskReRunner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,33 +141,33 @@ public static void Run(string path,

// Register the parameters needed for processing :
// communication token, payload and session IDs, configuration settings, data dependencies, folder location, expected output keys, task ID, and task options.
var toProcess = new DumpFormat
{
PayloadId = payloadId,
SessionId = sessionId,
Configuration = configuration,
DataDependencies =
{
dd1,
},
ExpectedOutputKeys =
{
eok1,
//eok2, // Uncomment to test multiple expected output keys (results)
},
TaskId = taskId,
TaskOptions = taskOptions,
RawData = rawData,
};
var DumpData = new DumpFormat
{
PayloadId = payloadId,
SessionId = sessionId,
Configuration = configuration,
DataDependencies =
{
dd1,
},
ExpectedOutputKeys =
{
eok1,
//eok2, // Uncomment to test multiple expected output keys (results)
},
TaskId = taskId,
TaskOptions = taskOptions,
RawData = rawData,
};


logger_.LogInformation("Created Data in {path}: {toProcess}",
logger_.LogInformation("Created Data in {path}: {DumpData}",
path,
toProcess);
DumpData);
/*
* Create a JSON file with all Data
*/
var JSONresult = JsonConvert.SerializeObject(toProcess);
var JSONresult = JsonConvert.SerializeObject(DumpData);

using (var tw = new StreamWriter(path,
false))
Expand Down Expand Up @@ -209,6 +209,18 @@ public static void Run(string path,
using var server = new Server("/tmp/agent.sock",
storage,
loggerConfiguration_);
var toProcess = new ProcessData
{
CommunicationToken = token,
PayloadId = input.PayloadId,
SessionId = input.SessionId,
Configuration = input.Configuration,
DataDependencies = input.DataDependencies,
DataFolder = dataFolder,
ExpectedOutputKeys = input.ExpectedOutputKeys,
TaskId = input.TaskId,
TaskOptions = input.TaskOptions,
};

// Call the Process method on the gRPC client `client` of type Worker.WorkerClient
client.Process(new ProcessRequest
Expand All @@ -230,8 +242,8 @@ public static void Run(string path,
TaskOptions = input.TaskOptions,
});
// Print information given to data
logger_.LogInformation("Task Data: {input}",
input);
logger_.LogInformation("Task Data: {toProcess}",
toProcess);
}

// Print everything in agent storage
Expand Down
4 changes: 2 additions & 2 deletions src/TaskReRunner/Storage/ProcessData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public record ProcessData
/// <summary>
/// Gets the list of data dependencies required for the process.
/// </summary>
public ICollection<string> DataDependencies { get; } = new List<string>();
public ICollection<string> DataDependencies { get; set; } = new List<string>();

/// <summary>
/// Gets the list of expected output keys.
/// </summary>
public ICollection<string> ExpectedOutputKeys { get; } = new List<string>();
public ICollection<string> ExpectedOutputKeys { get; set; } = new List<string>();

/// <summary>
/// Gets or init the communication token required for the process.
Expand Down

0 comments on commit 8f0a714

Please sign in to comment.