diff --git a/batch/batch.go b/batch/batch.go index b4d8ac35a736affc4bef1db4f78f87a253e5a1de..5069ac33ed9b6d706ea0c094e337c4e48b9cf907 100644 --- a/batch/batch.go +++ b/batch/batch.go @@ -34,7 +34,7 @@ type BatchJobQueue string type BatchJobMessageType string type BatchJob struct { - Name string + Name *string Job any FullJobDefinition string FullJobQueue string @@ -60,10 +60,10 @@ func SubmitJob(batchJob BatchJob) error { batchClient := batch.NewFromConfig(cfg) - if batchJob.Name == "" { + if batchJob.Name == nil { id := uuid.New() jobID := "job" + id.String() - batchJob.Name = jobID + batchJob.Name = utils.ValueToPointer(jobID) } err = uploadMessageToS3(batchJob) @@ -73,7 +73,7 @@ func SubmitJob(batchJob BatchJob) error { command := []string{ binaryPath, - batchJob.Name, + utils.PointerToValue(batchJob.Name), } environmentOverwrite := []types.KeyValuePair{{ @@ -84,7 +84,7 @@ func SubmitJob(batchJob BatchJob) error { input := &batch.SubmitJobInput{ JobDefinition: utils.ValueToPointer(batchJob.FullJobDefinition), - JobName: aws.String(batchJob.Name), + JobName: batchJob.Name, JobQueue: aws.String(batchJob.FullJobQueue), ContainerOverrides: &types.ContainerOverrides{ Command: command, @@ -106,7 +106,7 @@ func uploadMessageToS3(batchJob BatchJob) error { // Upload message _, err = s3.GetClient(batchJob.IsDebug).UploadWithSettingsRevised(jobBytes, batchJob.MessagesBucketName, s3.S3UploadSettings{ - FileName: batchJob.Name, + FileName: utils.PointerToValue(batchJob.Name), }) if err != nil { return err