Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bobgroup-go-utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bob Public Utils
bobgroup-go-utils
Commits
9ee531c4
Commit
9ee531c4
authored
1 year ago
by
Daniel Naude
Browse files
Options
Downloads
Patches
Plain Diff
Refactor BatchJob struct to use pointer for Name field
parent
c0c2e5bd
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!48
Migrate to aws sdk for go v2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
batch/batch.go
+6
-6
6 additions, 6 deletions
batch/batch.go
with
6 additions
and
6 deletions
batch/batch.go
+
6
−
6
View file @
9ee531c4
...
@@ -34,7 +34,7 @@ type BatchJobQueue string
...
@@ -34,7 +34,7 @@ type BatchJobQueue string
type
BatchJobMessageType
string
type
BatchJobMessageType
string
type
BatchJob
struct
{
type
BatchJob
struct
{
Name
string
Name
*
string
Job
any
Job
any
FullJobDefinition
string
FullJobDefinition
string
FullJobQueue
string
FullJobQueue
string
...
@@ -60,10 +60,10 @@ func SubmitJob(batchJob BatchJob) error {
...
@@ -60,10 +60,10 @@ func SubmitJob(batchJob BatchJob) error {
batchClient
:=
batch
.
NewFromConfig
(
cfg
)
batchClient
:=
batch
.
NewFromConfig
(
cfg
)
if
batchJob
.
Name
==
""
{
if
batchJob
.
Name
==
nil
{
id
:=
uuid
.
New
()
id
:=
uuid
.
New
()
jobID
:=
"job"
+
id
.
String
()
jobID
:=
"job"
+
id
.
String
()
batchJob
.
Name
=
jobID
batchJob
.
Name
=
utils
.
ValueToPointer
(
jobID
)
}
}
err
=
uploadMessageToS3
(
batchJob
)
err
=
uploadMessageToS3
(
batchJob
)
...
@@ -73,7 +73,7 @@ func SubmitJob(batchJob BatchJob) error {
...
@@ -73,7 +73,7 @@ func SubmitJob(batchJob BatchJob) error {
command
:=
[]
string
{
command
:=
[]
string
{
binaryPath
,
binaryPath
,
batchJob
.
Name
,
utils
.
PointerToValue
(
batchJob
.
Name
)
,
}
}
environmentOverwrite
:=
[]
types
.
KeyValuePair
{{
environmentOverwrite
:=
[]
types
.
KeyValuePair
{{
...
@@ -84,7 +84,7 @@ func SubmitJob(batchJob BatchJob) error {
...
@@ -84,7 +84,7 @@ func SubmitJob(batchJob BatchJob) error {
input
:=
&
batch
.
SubmitJobInput
{
input
:=
&
batch
.
SubmitJobInput
{
JobDefinition
:
utils
.
ValueToPointer
(
batchJob
.
FullJobDefinition
),
JobDefinition
:
utils
.
ValueToPointer
(
batchJob
.
FullJobDefinition
),
JobName
:
aws
.
String
(
batchJob
.
Name
)
,
JobName
:
batchJob
.
Name
,
JobQueue
:
aws
.
String
(
batchJob
.
FullJobQueue
),
JobQueue
:
aws
.
String
(
batchJob
.
FullJobQueue
),
ContainerOverrides
:
&
types
.
ContainerOverrides
{
ContainerOverrides
:
&
types
.
ContainerOverrides
{
Command
:
command
,
Command
:
command
,
...
@@ -106,7 +106,7 @@ func uploadMessageToS3(batchJob BatchJob) error {
...
@@ -106,7 +106,7 @@ func uploadMessageToS3(batchJob BatchJob) error {
// Upload message
// Upload message
_
,
err
=
s3
.
GetClient
(
batchJob
.
IsDebug
)
.
UploadWithSettingsRevised
(
jobBytes
,
batchJob
.
MessagesBucketName
,
s3
.
S3UploadSettings
{
_
,
err
=
s3
.
GetClient
(
batchJob
.
IsDebug
)
.
UploadWithSettingsRevised
(
jobBytes
,
batchJob
.
MessagesBucketName
,
s3
.
S3UploadSettings
{
FileName
:
batchJob
.
Name
,
FileName
:
utils
.
PointerToValue
(
batchJob
.
Name
)
,
})
})
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment