Commit aa308410 authored by Romain Reuillon's avatar Romain Reuillon
Browse files

Merge branch 'refresh' into 'master'

[Plugin] enh: add refresh option to slurm environment

See merge request openmole/openmole!12
parents 22e00d91 21c54978
......@@ -53,6 +53,7 @@ object SLURMEnvironment {
name: OptionalArgument[String] = None,
localSubmission: Boolean = false,
forceCopyOnNode: Boolean = false,
refresh: OptionalArgument[Time] = None,
debug: Boolean = false
)(implicit services: BatchEnvironment.Services, authenticationStore: AuthenticationStore, cypher: Cypher, varName: sourcecode.Name) = {
import services._
......@@ -74,6 +75,7 @@ object SLURMEnvironment {
threads = threads,
storageSharedLocally = storageSharedLocally,
forceCopyOnNode = forceCopyOnNode,
refresh = refresh,
debug = debug)
EnvironmentProvider { ms
......@@ -120,9 +122,10 @@ object SLURMEnvironment {
threads: Option[Int],
storageSharedLocally: Boolean,
forceCopyOnNode: Boolean,
refresh: Option[Time],
debug: Boolean)
def submit[S: StorageInterface: HierarchicalStorageInterface: EnvironmentStorage](batchExecutionJob: BatchExecutionJob, storage: S, space: StorageSpace, jobService: SLURMJobService[_, _])(implicit services: BatchEnvironment.Services) =
def submit[S: StorageInterface: HierarchicalStorageInterface: EnvironmentStorage](batchExecutionJob: BatchExecutionJob, storage: S, space: StorageSpace, jobService: SLURMJobService[_, _], refresh: Option[Time])(implicit services: BatchEnvironment.Services) =
submitToCluster(
batchExecutionJob,
storage,
......@@ -130,7 +133,8 @@ object SLURMEnvironment {
jobService.submit(_, _, _),
jobService.state(_),
jobService.delete(_),
jobService.stdOutErr(_))
jobService.stdOutErr(_),
refresh)
}
......@@ -189,8 +193,8 @@ class SLURMEnvironment[A: gridscale.ssh.SSHAuthentication](
def execute(batchExecutionJob: BatchExecutionJob) =
storageService match {
case Left((space, local)) SLURMEnvironment.submit(batchExecutionJob, local, space, pbsJobService)
case Right((space, ssh)) SLURMEnvironment.submit(batchExecutionJob, ssh, space, pbsJobService)
case Left((space, local)) SLURMEnvironment.submit(batchExecutionJob, local, space, pbsJobService, parameters.refresh)
case Right((space, ssh)) SLURMEnvironment.submit(batchExecutionJob, ssh, space, pbsJobService, parameters.refresh)
}
lazy val installRuntime =
......@@ -230,7 +234,7 @@ class SLURMLocalEnvironment(
lazy val storage = localStorage(env, parameters.sharedDirectory, AccessControl(preference(SSHEnvironment.maxConnections)))
lazy val space = localStorageSpace(storage)
def execute(batchExecutionJob: BatchExecutionJob) = SLURMEnvironment.submit(batchExecutionJob, storage, space, jobService)
def execute(batchExecutionJob: BatchExecutionJob) = SLURMEnvironment.submit(batchExecutionJob, storage, space, jobService, parameters.refresh)
lazy val installRuntime = new RuntimeInstallation(Frontend.local, storage, space.baseDirectory)
......
......@@ -165,7 +165,8 @@ package object ssh {
submit: (SerializedJob, String, String) => J,
state: J => ExecutionState,
delete: J => Unit,
stdOutErr: J => (String, String))(implicit services: BatchEnvironment.Services) = {
stdOutErr: J => (String, String),
refresh: Option[Time] = None)(implicit services: BatchEnvironment.Services) = {
import services._
val jobDirectory = HierarchicalStorageSpace.createJobDirectory(storage, space)
......@@ -192,7 +193,7 @@ package object ssh {
BatchJobControl(
batchExecutionJob.environment,
BatchEnvironment.defaultUpdateInterval(services.preference),
refresh.map(UpdateInterval.fixed) getOrElse BatchEnvironment.defaultUpdateInterval(services.preference),
StorageService.id(storage),
() => state(job),
() delete(job),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment