DistLRE is a tool that can be used for remote and local execution of tasks. For use within our group a copy is saved in /home/aifs2/group/code/DistLRE
Using pip you can install that precise version to your Python environment: pip install /home/aifs2/group/code/DistLRE
The tool is a Python package that can be used as a framework for writing experiment execution code in Python.
Each task is run with a parallel process to monitor system resources effectively.
Supports running local commands, time limit is expressed in seconds and memory is in GB. For example, a simple execution locally:
from distlre.distlre import DistLRE, Task, RemoteHost
executor = DistLRE(local_threads=1)
task = Task(command='ls ~', meta='META', time_limit=10, memory_limit=10)
future = executor.submit(task)
executor.execute_tasks()
executor.wait()
print(future.result().output)
You can also run commands on a remote host, done over ssh and requires a user-specified method of reporting memory usage.
A simple memory reporter can be made using the psutil package and adding the script to your /usr/bin:
#! /usr/bin/env python
import psutil
if __name__ == '__main__':
print(psutil.virtual_memory().used)
For example saving the above script as getpsutil in /usr/bin we can use it as the memory reporter for a remote script execution:
executor = DistLRE(remote_hosts=[RemoteHost('localhost',
mem_check='source ~/.bashrc && getpsutil',
port=22)])
task = Task(command='ls ~', meta='META', time_limit=10, memory_limit=10)
other_task = Task(command='cd ~', meta='META', time_limit=10, memory_limit=10)
future = executor.submit(task)
other_future = executor.submit(other_task)
executor.execute_tasks()
executor.wait()
print(future.result().output)
For more information head over to the GitHub page: https://github.com/csbence/distlre
Comments (0)
You don't have permission to comment on this page.