Skip to content

Commit

Permalink
[GH-63] Ignore the time limit by default.
Browse files Browse the repository at this point in the history
Add a `ignoreTimeLimits` option in float and default to true.
If user want to enable time limit, he/she needs to explicitly set
this option to `false`.
  • Loading branch information
jealous committed Aug 21, 2024
1 parent c3dcfc9 commit 465a4a3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ Available `float` config options:
the CLI usage for the list of available options.
* `vmPolicy`: the VM creation policy, specified as a map. Refer to the CLI usage
for the list of available options.
* `ignoreTimeLimits`: a boolean. default to true. If set to true, the plugin will ignore
the time limit of the task.
* `timeFactor`: a float number. default to 1. An extra factor to multiply based
on the time supplied by the task. Add time factor to enlarge the default timeout of the task.
Because WaveRider may take extra time for job migration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class FloatConf {
String migratePolicy
String extraOptions
String commonExtra
boolean ignoreTimeFactor = true

float timeFactor = 1
float cpuFactor = 1
Expand Down Expand Up @@ -166,6 +167,9 @@ class FloatConf {
if (floatNode.memoryFactor) {
this.memoryFactory = floatNode.memoryFactor as Float
}
if (floatNode.containsKey('ignoreTimeFactor')) {
this.ignoreTimeFactor = floatNode.ignoreTimeFactor as Boolean
}
this.commonExtra = floatNode.commonExtra

if (floatNode.cpu)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ class FloatGridExecutor extends AbstractGridExecutor {
cmd << '--instType' << task.config.getMachineType()
}
addVolSize(cmd, task)
if (task.config.getTime()) {
if (!floatConf.ignoreTimeFactor && task.config.getTime()) {
Float seconds = task.config.getTime().toSeconds()
seconds *= floatConf.timeFactor
cmd << '--timeLimit' << "${seconds.toInteger()}s".toString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ class FloatGridExecutorTest extends FloatBaseTest {
cmd.join(' ').contains('--imageVolSize 41')
}

def "use time directive"() {
def "by default, ignore the time directive"() {
given:
final exec = newTestExecutor()
final task = newTask(exec, 0, new TaskConfig(
Expand All @@ -414,6 +414,27 @@ class FloatGridExecutorTest extends FloatBaseTest {
when:
final cmd = exec.getSubmitCommandLine(task, Paths.get(script))

then:
!cmd.join(' ').contains('--timeLimit')
}

def "use time directive"() {
given:
final exec = newTestExecutor([
float: [address: addr,
username: user,
password: pass,
nfs: nfs,
ignoreTimeFactor: false]
])
final task = newTask(exec, 0, new TaskConfig(
container: image,
time: '24h',
))

when:
final cmd = exec.getSubmitCommandLine(task, Paths.get(script))

then:
cmd.join(' ').contains('--timeLimit 86400s')
}
Expand All @@ -425,6 +446,7 @@ class FloatGridExecutorTest extends FloatBaseTest {
username : user,
password : pass,
nfs : nfs,
ignoreTimeFactor: false,
timeFactor: 1.1]])
final task = newTask(exec, 0, new TaskConfig(
container: image,
Expand Down

0 comments on commit 465a4a3

Please sign in to comment.