Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aurel
jio
Commits
37298d30
Commit
37298d30
authored
Jan 10, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jslint pass waitStatus.js
parent
8d6e596b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
93 deletions
+96
-93
src/jio/jobs/status/waitStatus.js
src/jio/jobs/status/waitStatus.js
+96
-93
No files found.
src/jio/jobs/status/waitStatus.js
View file @
37298d30
var
waitStatus
=
function
(
spec
,
my
)
{
var
that
=
jobStatus
(
spec
,
my
);
spec
=
spec
||
{};
my
=
my
||
{};
// Attributes //
var
priv
=
{};
priv
.
job_id_array
=
spec
.
job_id_array
||
[];
priv
.
threshold
=
0
;
/*jslint indent: 2, maxlen: 80, sloppy: true */
/*global jobStatus: true, jobManager: true */
var
waitStatus
=
function
(
spec
,
my
)
{
var
that
=
jobStatus
(
spec
,
my
),
priv
=
{};
spec
=
spec
||
{};
my
=
my
||
{};
// Attributes //
priv
.
job_id_array
=
spec
.
job_id_array
||
[];
priv
.
threshold
=
0
;
// Methods //
/**
* Returns the label of this status.
* @method getLabel
* @return {string} The label: 'wait'.
*/
that
.
getLabel
=
function
()
{
return
'
wait
'
;
};
// Methods //
/**
* Returns the label of this status.
* @method getLabel
* @return {string} The label: 'wait'.
*/
that
.
getLabel
=
function
()
{
return
'
wait
'
;
};
/**
* Refresh the job id array to wait.
* @method refreshJobIdArray
*/
priv
.
refreshJobIdArray
=
function
()
{
var
tmp_job_id_array
=
[],
i
;
for
(
i
=
0
;
i
<
priv
.
job_id_array
.
length
;
i
+=
1
)
{
if
(
jobManager
.
jobIdExists
(
priv
.
job_id_array
[
i
]))
{
tmp_job_id_array
.
push
(
priv
.
job_id_array
[
i
]);
}
}
priv
.
job_id_array
=
tmp_job_id_array
;
};
/**
* Refresh the job id array to wait.
* @method refreshJobIdArray
*/
priv
.
refreshJobIdArray
=
function
()
{
var
tmp_job_id_array
=
[],
i
;
for
(
i
=
0
;
i
<
priv
.
job_id_array
.
length
;
i
+=
1
)
{
if
(
jobManager
.
jobIdExists
(
priv
.
job_id_array
[
i
]))
{
tmp_job_id_array
.
push
(
priv
.
job_id_array
[
i
]);
}
}
priv
.
job_id_array
=
tmp_job_id_array
;
};
/**
* The status must wait for the job end before start again.
* @method waitForJob
* @param {object} job The job to wait for.
*/
that
.
waitForJob
=
function
(
job
)
{
var
i
;
for
(
i
=
0
;
i
<
priv
.
job_id_array
.
length
;
i
+=
1
)
{
if
(
priv
.
job_id_array
[
i
]
===
job
.
getId
())
{
return
;
}
}
priv
.
job_id_array
.
push
(
job
.
getId
());
};
/**
* The status must wait for the job end before start again.
* @method waitForJob
* @param {object} job The job to wait for.
*/
that
.
waitForJob
=
function
(
job
)
{
var
i
;
for
(
i
=
0
;
i
<
priv
.
job_id_array
.
length
;
i
+=
1
)
{
if
(
priv
.
job_id_array
[
i
]
===
job
.
getId
())
{
return
;
}
}
priv
.
job_id_array
.
push
(
job
.
getId
());
};
/**
* The status stops to wait for this job.
* @method dontWaitForJob
* @param {object} job The job to stop waiting for.
*/
that
.
dontWaitForJob
=
function
(
job
)
{
var
i
,
tmp_job_id_array
=
[];
for
(
i
=
0
;
i
<
priv
.
job_id_array
.
length
;
i
+=
1
)
{
if
(
priv
.
job_id_array
[
i
]
!==
job
.
getId
())
{
tmp_job_id_array
.
push
(
priv
.
job_id_array
[
i
]);
}
}
priv
.
job_id_array
=
tmp_job_id_array
;
};
/**
* The status stops to wait for this job.
* @method dontWaitForJob
* @param {object} job The job to stop waiting for.
*/
that
.
dontWaitForJob
=
function
(
job
)
{
var
i
,
tmp_job_id_array
=
[];
for
(
i
=
0
;
i
<
priv
.
job_id_array
.
length
;
i
+=
1
)
{
if
(
priv
.
job_id_array
[
i
]
!==
job
.
getId
())
{
tmp_job_id_array
.
push
(
priv
.
job_id_array
[
i
]);
}
}
priv
.
job_id_array
=
tmp_job_id_array
;
};
/**
* The status must wait for some milliseconds.
* @method waitForTime
* @param {number} ms The number of milliseconds
*/
that
.
waitForTime
=
function
(
ms
)
{
priv
.
threshold
=
Date
.
now
()
+
ms
;
};
/**
* The status must wait for some milliseconds.
* @method waitForTime
* @param {number} ms The number of milliseconds
*/
that
.
waitForTime
=
function
(
ms
)
{
priv
.
threshold
=
Date
.
now
()
+
ms
;
};
/**
* The status stops to wait for some time.
* @method stopWaitForTime
*/
that
.
stopWaitForTime
=
function
()
{
priv
.
threshold
=
0
;
};
/**
* The status stops to wait for some time.
* @method stopWaitForTime
*/
that
.
stopWaitForTime
=
function
()
{
priv
.
threshold
=
0
;
};
that
.
canStart
=
function
()
{
priv
.
refreshJobIdArray
();
return
(
priv
.
job_id_array
.
length
===
0
&&
Date
.
now
()
>=
priv
.
threshold
);
};
that
.
canRestart
=
function
()
{
return
that
.
canStart
();
};
that
.
canStart
=
function
()
{
priv
.
refreshJobIdArray
();
return
(
priv
.
job_id_array
.
length
===
0
&&
Date
.
now
()
>=
priv
.
threshold
);
};
that
.
canRestart
=
function
()
{
return
that
.
canStart
();
};
that
.
serialized
=
function
()
{
return
{
label
:
that
.
getLabel
(),
waitfortime
:
priv
.
threshold
,
waitforjob
:
priv
.
job_id_array
};
that
.
serialized
=
function
()
{
return
{
"
label
"
:
that
.
getLabel
(),
"
waitfortime
"
:
priv
.
threshold
,
"
waitforjob
"
:
priv
.
job_id_array
};
};
/**
* Checks if this status is waitStatus
* @method isWaitStatus
* @return {boolean} true
*/
that
.
isWaitStatus
=
function
()
{
return
true
;
};
/**
* Checks if this status is waitStatus
* @method isWaitStatus
* @return {boolean} true
*/
that
.
isWaitStatus
=
function
()
{
return
true
;
};
return
that
;
return
that
;
};
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