globus / globus-compute

Globus Compute: High Performance Function Serving for Science
https://www.globus.org/compute
Apache License 2.0
138 stars 44 forks source link

Bash functions #1593

Open yadudoc opened 2 weeks ago

yadudoc commented 2 weeks ago

Description

Support for BashFunctions and MPIFunctions.

BashFunctions look like this:

bf = BashFunction('echo "Hello World! - {counter}" ')
fu = executor.submit(bf, counter=5)
bash_result = fu.result()  # BashFunctions return a BashResult object

# Pull results:
>>> print(bash_result.returncode)  #  returns 0 on success, non-zero on failure
0

>>> print(bash_result.stdout)          # snippet of up to 10K lines from stdout
Hello World! - 5

>>>print(bash_result.stderr)           # snippet of up to 10K lines from stderr
--> executable follows <--
echo "Hello World! - 5"
--> end executable <--

>>> print(bash_result.cmd)              # formatted command that was executed remotely
'echo "Hello World! - 5" '

Fixes # (issue)

Type of change

Choose which options apply, and delete the ones which do not apply.