Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Yaxel Perez
jio
Commits
e3bf3e8c
Commit
e3bf3e8c
authored
Aug 26, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
job checker upgraded to deny jobs and to check single job
parent
6b39103c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
17 deletions
+48
-17
src/jio/features/jobChecker.js
src/jio/features/jobChecker.js
+48
-17
No files found.
src/jio/features/jobChecker.js
View file @
e3bf3e8c
...
...
@@ -44,8 +44,12 @@ function enableJobChecker(jio, shared, options) {
new_job
.
modified
=
new
Date
();
},
deny
:
function
(
original_job
,
new_job
)
{
// XXX
return
;
new_job
.
state
=
'
running
'
;
new_job
.
command
.
reject
(
'
precondition_failed
'
,
'
command denied
'
,
'
Command rejected by the job checker.
'
);
}
};
...
...
@@ -70,10 +74,18 @@ function enableJobChecker(jio, shared, options) {
// wrong conditions
return
;
}
if
(
job_rule
.
single
!==
undefined
&&
typeof
job_rule
.
single
!==
'
boolean
'
)
{
// wrong single property
return
;
}
if
(
indexOf
(
job_rule
.
action
,
shared
.
job_rule_action_names
)
===
-
1
)
{
// wrong action
return
;
}
if
(
job_rule
.
action
!==
'
deny
'
&&
job_rule
.
single
===
true
)
{
// only 'deny' action doesn't require original_job parameter
return
;
}
if
(
typeof
job_rule
.
after
!==
'
string
'
)
{
job_rule
.
after
=
''
;
...
...
@@ -97,6 +109,7 @@ function enableJobChecker(jio, shared, options) {
job_rule
=
{
"
code_name
"
:
job_rule
.
code_name
,
"
conditions
"
:
job_rule
.
conditions
,
"
single
"
:
job_rule
.
single
||
false
,
"
action
"
:
job_rule
.
action
||
"
ok
"
};
...
...
@@ -137,6 +150,22 @@ function enableJobChecker(jio, shared, options) {
if
(
job
.
state
===
'
ready
'
)
{
// browsing rules
for
(
i
=
0
;
i
<
shared
.
job_rules
.
length
;
i
+=
1
)
{
if
(
shared
.
job_rules
[
i
].
single
)
{
// no browse
if
(
jobsRespectConditions
(
job
,
undefined
,
shared
.
job_rules
[
i
].
conditions
)
)
{
shared
.
job_rule_actions
[
shared
.
job_rules
[
i
].
action
](
undefined
,
job
);
return
;
}
}
else
{
// browsing jobs
for
(
j
=
0
;
j
<
shared
.
jobs
.
length
;
j
+=
1
)
{
if
(
shared
.
jobs
[
j
]
!==
job
)
{
...
...
@@ -158,6 +187,7 @@ function enableJobChecker(jio, shared, options) {
}
}
}
}
if
(
options
.
job_management
!==
false
)
{
...
...
@@ -203,4 +233,5 @@ function enableJobChecker(jio, shared, options) {
jio
.
jobRules
=
function
()
{
return
deepClone
(
shared
.
job_rules
);
};
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment