Skip to content

Commit

Permalink
sync the float binary.
Browse files Browse the repository at this point in the history
Sync the float binary with the opcenter when the plugin started.
  • Loading branch information
jealous committed Aug 29, 2023
1 parent f46dd91 commit 610421a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
12 changes: 6 additions & 6 deletions plugins/nf-float/src/main/com/memverge/nextflow/FloatBin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ class FloatBin {
private static final binName = 'float'

static Path get(String opCenterAddr) {
if (!opCenterAddr) {
return Paths.get(binName)
}
def ret = getFloatBinPath()
if (ret == null) {
if (!opCenterAddr) {
// no where to retrieve the binary
return Paths.get(binName)
}
final URL src = getDownloadUrl(opCenterAddr)
final Path pluginsDir = Global.getPluginsDir()
ret = pluginsDir.resolve(binName)
Expand Down Expand Up @@ -45,9 +46,8 @@ class FloatBin {

private static Path getFloatBinPath() {
final sep = Pattern.quote(File.pathSeparator)
def paths = Arrays.asList(System.getenv("PATH").split(sep))
paths = new ArrayList<String>(paths)
paths.add(Global.getPluginsDir().toString())
def paths = [Global.getPluginsDir().toString()]
paths.addAll(Arrays.asList(System.getenv("PATH").split(sep)))
for (String path : paths) {
def floatPath = Paths.get(path).resolve(binName)
if (Files.exists(floatPath)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class FloatGridExecutor extends AbstractGridExecutor {
protected void register() {
super.register()
uploadBinDir()
syncFloatBin()
}

@Override
Expand Down Expand Up @@ -113,6 +114,14 @@ class FloatGridExecutor extends AbstractGridExecutor {
}
}

private void syncFloatBin() {
final oc = floatJobs.getOc("")
def cmd = floatConf.getCliPrefix(oc)
cmd << "release" << "sync"
def res = Global.execute(cmd)
log.info "[float] sync the float binary, $res"
}

private static String getMemory(TaskRun task) {
final mem = task.config.getMemory()
final giga = mem?.toGiga()
Expand Down
4 changes: 4 additions & 0 deletions plugins/nf-float/src/main/com/memverge/nextflow/Global.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class CmdRes {
return exit == 0
}

String toString() {
return "exit code: ${exit}, out: ${out}"
}

int exit
String out
}
Expand Down

0 comments on commit 610421a

Please sign in to comment.