using Godot;
using System;
using System.Threading.Tasks;
using BSEnroll; // Namespace for UserDataManager
///
/// Manages the triggering of training jobs after data upload.
///
public class TrainingJobManager
{
///
/// Enqueues a training job using the provided S3 data path.
///
/// The S3 path where the data was uploaded.
/// True if the training job was successfully enqueued, false otherwise.
public static async Task EnqueueTrainingJob(string s3Path)
{
if (string.IsNullOrEmpty(s3Path))
{
GD.PrintErr("Cannot enqueue training job: S3 path is empty");
return false;
}
try
{
GD.Print($"Enqueueing training job for data at: {s3Path}");
bool success = await UserDataManager.Instance.EnqueueTrainingJobAsync(s3Path);
if (success)
{
GD.Print("Training job enqueued successfully");
}
else
{
GD.PrintErr("Failed to enqueue training job");
}
return success;
}
catch (Exception ex)
{
GD.PrintErr($"Error enqueueing training job: {ex.Message}");
GD.PrintErr(ex.StackTrace);
return false;
}
}
}