Skip to content

Commit

Permalink
Merge pull request #3163 from boegel/RPackage_run_async
Browse files Browse the repository at this point in the history
update `run_async` methods in `RPackage`, `Rmpi`, and `Rserve` easyblocks to use submit `run_shell_cmd` call into thread pool
  • Loading branch information
branfosj authored Feb 23, 2024
2 parents 53e5cda + fbb44eb commit 585b539
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions easybuild/easyblocks/generic/rpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,14 @@ def run(self):
cmd, stdin = self.prepare_r_ext_install()
self.install_R_package(cmd, inp=stdin)

def run_async(self):
def run_async(self, thread_pool):
"""
Start installation of R package as an extension asynchronously.
"""
cmd, stdin = self.prepare_r_ext_install()
self.async_cmd_start(cmd, inp=stdin)
task_id = f'ext_{self.name}_{self.version}'
return thread_pool.submit(run_shell_cmd, cmd, stdin=stdin, asynchronous=True, env=os.environ.copy(),
fail_on_error=False, task_id=task_id)

def async_cmd_check(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions easybuild/easyblocks/r/rmpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ def run(self):
# it might be needed to get the R cmd and run it with mympirun...
super(EB_Rmpi, self).run()

def run_async(self):
def run_async(self, *args, **kwargs):
"""
Asynchronously install Rmpi as extension, after seting various configure arguments.
"""
self.prepare_rmpi_configureargs()
# it might be needed to get the R cmd and run it with mympirun...
super(EB_Rmpi, self).run_async()
return super(EB_Rmpi, self).run_async(*args, **kwargs)
4 changes: 2 additions & 2 deletions easybuild/easyblocks/r/rserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def run(self):
self.configurevars = ['LIBS="$LIBS -lpthread"']
super(EB_Rserve, self).run()

def run_async(self):
def run_async(self, *args, **kwargs):
"""Set LIBS environment variable correctly prior to building."""
self.configurevars = ['LIBS="$LIBS -lpthread"']
super(EB_Rserve, self).run_async()
return super(EB_Rserve, self).run_async(*args, **kwargs)

0 comments on commit 585b539

Please sign in to comment.