Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Job Queues
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Libraries
Go
Services
Job Queues
Compare revisions
v1.13.2 to v1.14.0
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
oss/libraries/go/services/job-queues
Select target project
No results found
v1.14.0
Select Git revision
Branches
master
Tags
v1.0.0
v1.0.1
v1.1.0
v1.10.0
v1.10.1
v1.10.2
v1.11.0
v1.12.0
v1.12.1
v1.12.2
v1.12.3
v1.12.4
v1.12.5
v1.12.6
v1.12.7
v1.12.8
v1.13.0
v1.13.1
v1.13.2
v1.14.0
v1.15.0
v1.15.1
v1.15.10
v1.15.11
v1.15.12
v1.15.13
v1.15.14
v1.15.15
v1.15.16
v1.15.17
v1.15.2
v1.15.3
v1.15.4
v1.15.5
v1.15.6
v1.15.7
v1.15.8
v1.15.9
v1.16.0
v1.16.1
v1.17.0
v1.18.0
v1.18.1
v1.18.2
v1.19.0
v1.19.1
v1.19.2
v1.19.3
v1.19.4
v1.2.0
v1.20.0
v1.20.1
v1.20.2
v1.20.3
v1.21.0
v1.21.1
v1.22.0
v1.23.0
v1.23.1
v1.23.2
v1.3.0
v1.3.1
v1.3.2
v1.4.0
v1.5.0
v1.5.1
v1.6.0
v1.6.1
v1.7.0
v1.7.1
v1.7.2
v1.7.3
v1.8.0
v1.8.1
v1.9.0
76 results
Swap
Target
oss/libraries/go/services/job-queues
Select target project
oss/libraries/go/services/job-queues
1 result
v1.13.2
Select Git revision
Branches
master
Tags
v1.0.0
v1.0.1
v1.1.0
v1.10.0
v1.10.1
v1.10.2
v1.11.0
v1.12.0
v1.12.1
v1.12.2
v1.12.3
v1.12.4
v1.12.5
v1.12.6
v1.12.7
v1.12.8
v1.13.0
v1.13.1
v1.13.2
v1.14.0
v1.15.0
v1.15.1
v1.15.10
v1.15.11
v1.15.12
v1.15.13
v1.15.14
v1.15.15
v1.15.16
v1.15.17
v1.15.2
v1.15.3
v1.15.4
v1.15.5
v1.15.6
v1.15.7
v1.15.8
v1.15.9
v1.16.0
v1.16.1
v1.17.0
v1.18.0
v1.18.1
v1.18.2
v1.19.0
v1.19.1
v1.19.2
v1.19.3
v1.19.4
v1.2.0
v1.20.0
v1.20.1
v1.20.2
v1.20.3
v1.21.0
v1.21.1
v1.22.0
v1.23.0
v1.23.1
v1.23.2
v1.3.0
v1.3.1
v1.3.2
v1.4.0
v1.5.0
v1.5.1
v1.6.0
v1.6.1
v1.7.0
v1.7.1
v1.7.2
v1.7.3
v1.8.0
v1.8.1
v1.9.0
76 results
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (1)
feat: new runJob method
#32
· 9d774f0a
Volker Schukai
authored
1 year ago
Verified
9d774f0a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
job-log.go
+11
-11
11 additions, 11 deletions
job-log.go
job-stat.go
+7
-7
7 additions, 7 deletions
job-stat.go
manager.go
+18
-0
18 additions, 0 deletions
manager.go
persistence.go
+2
-2
2 additions, 2 deletions
persistence.go
with
38 additions
and
20 deletions
job-log.go
View file @
9d774f0a
...
...
@@ -6,20 +6,20 @@ import (
)
type
JobLog
struct
{
LogID
uint
`gorm:"primarykey;autoIncrement:true" json:"log
_i
d"`
JobID
JobID
`json:"job
_i
d" gorm:"type:varchar(255);foreignKey:JobID;references:ID"`
ProcessID
int
`json:"process
_i
d"`
StartTime
time
.
Time
`json:"start
_t
ime"`
EndTime
time
.
Time
`json:"end
_t
ime"`
ExitCode
int
`json:"exit
_c
ode"`
LogID
uint
`gorm:"primarykey;autoIncrement:true" json:"log
I
d"`
JobID
JobID
`json:"job
I
d" gorm:"type:varchar(255);foreignKey:JobID;references:ID"`
ProcessID
int
`json:"process
I
d"`
StartTime
time
.
Time
`json:"start
T
ime"`
EndTime
time
.
Time
`json:"end
T
ime"`
ExitCode
int
`json:"exit
C
ode"`
Result
string
`json:"output" gorm:"type:TEXT"`
// Assuming serialized JSON for any type
ResourceUsage
ResourceUsage
`json:"resource
_u
sage" gorm:"embedded;embeddedPrefix:resource_usage_"`
ResourceUsage
ResourceUsage
`json:"resource
U
sage" gorm:"embedded;embeddedPrefix:resource_usage_"`
IO
IO
`json:"io" gorm:"embedded;embeddedPrefix:io_"`
ErrorMsg
string
`json:"error
_m
sg"`
IsSuccessful
bool
`json:"is
_s
uccessful"`
ErrorMsg
string
`json:"error
M
sg"`
IsSuccessful
bool
`json:"is
S
uccessful"`
CreatedAt
time
.
Time
`gorm:"column:created_at" json:"created
_a
t" yaml:"created
_a
t"`
UpdatedAt
time
.
Time
`gorm:"column:updated_at" json:"updated
_a
t" yaml:"updated
_a
t"`
CreatedAt
time
.
Time
`gorm:"column:created_at" json:"created
A
t" yaml:"created
A
t"`
UpdatedAt
time
.
Time
`gorm:"column:updated_at" json:"updated
A
t" yaml:"updated
A
t"`
DeletedAt
gorm
.
DeletedAt
`gorm:"column:deleted_at;index" json:"-" yaml:"-"`
}
...
...
This diff is collapsed.
Click to expand it.
job-stat.go
View file @
9d774f0a
...
...
@@ -7,14 +7,14 @@ import (
// important: if you want to add fields to this struct, you have to add them to the ResetStats() method as well
type
JobStats
struct
{
JobID
JobID
`json:"job
_i
d" gorm:"primaryKey"`
RunCount
int
`json:"run
_c
ount"`
SuccessCount
int
`json:"success
_c
ount"`
ErrorCount
int
`json:"error
_c
ount"`
TimeMetrics
TimeMetrics
`json:"time
_m
etrics" gorm:"embedded;embeddedPrefix:time_metrics_"`
JobID
JobID
`json:"job
I
d" gorm:"primaryKey"`
RunCount
int
`json:"run
C
ount"`
SuccessCount
int
`json:"success
C
ount"`
ErrorCount
int
`json:"error
C
ount"`
TimeMetrics
TimeMetrics
`json:"time
M
etrics" gorm:"embedded;embeddedPrefix:time_metrics_"`
CreatedAt
time
.
Time
`gorm:"column:created_at" json:"created
_a
t" yaml:"created
_a
t"`
UpdatedAt
time
.
Time
`gorm:"column:updated_at" json:"updated
_a
t" yaml:"updated
_a
t"`
CreatedAt
time
.
Time
`gorm:"column:created_at" json:"created
A
t" yaml:"created
A
t"`
UpdatedAt
time
.
Time
`gorm:"column:updated_at" json:"updated
A
t" yaml:"updated
A
t"`
DeletedAt
gorm
.
DeletedAt
`gorm:"column:deleted_at;index" json:"-" yaml:"-"`
}
...
...
This diff is collapsed.
Click to expand it.
manager.go
View file @
9d774f0a
...
...
@@ -481,12 +481,30 @@ func (m *Manager) SetLogger(logger Logger) *Manager {
return
m
}
// GetLogger returns the logger
func
(
m
*
Manager
)
GetLogger
()
Logger
{
m
.
mu
.
Lock
()
defer
m
.
mu
.
Unlock
()
return
m
.
logger
}
// RunJob runs a job immediately and does not schedule it
func
(
m
*
Manager
)
RunJob
(
job
GenericJob
)
error
{
m
.
mu
.
Lock
()
defer
m
.
mu
.
Unlock
()
if
m
.
state
!=
ManagerStateRunning
{
return
ErrManagerNotRunning
}
if
!
job
.
IsPaused
()
{
m
.
eventBus
.
Publish
(
QueueJob
,
job
)
}
return
nil
}
// ScheduleJob schedules a job
func
(
m
*
Manager
)
ScheduleJob
(
job
GenericJob
,
scheduler
Scheduler
)
error
{
m
.
mu
.
Lock
()
...
...
This diff is collapsed.
Click to expand it.
persistence.go
View file @
9d774f0a
...
...
@@ -30,8 +30,8 @@ type JobPersistence struct {
Logs
[]
JobLog
`gorm:"foreignKey:JobID;references:ID" json:"-" yaml:"-"`
Stats
JobStats
`gorm:"foreignKey:JobID" json:"stats" yaml:"stats"`
CreatedAt
time
.
Time
`gorm:"column:created_at" json:"created
_a
t" yaml:"created
_a
t"`
UpdatedAt
time
.
Time
`gorm:"column:updated_at" json:"updated
_a
t" yaml:"updated
_a
t"`
CreatedAt
time
.
Time
`gorm:"column:created_at" json:"created
A
t" yaml:"created
A
t"`
UpdatedAt
time
.
Time
`gorm:"column:updated_at" json:"updated
A
t" yaml:"updated
A
t"`
DeletedAt
gorm
.
DeletedAt
`gorm:"column:deleted_at;index" json:"-" yaml:"-"`
}
...
...
This diff is collapsed.
Click to expand it.