Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed May 7, 2024
1 parent 0db9514 commit cad6c60
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
2 changes: 1 addition & 1 deletion bfabric/scripts/bfabric_upload_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import json
from pathlib import Path

from bfabric.bfabric2 import Bfabric, get_system_auth
from bfabric.bfabric2 import Bfabric


def bfabric_upload_resource(filename: Path, workunit_id: int) -> None:
Expand Down
37 changes: 13 additions & 24 deletions bfabric/scripts/bfabric_upload_submitter_executable.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python3
# -*- coding: latin1 -*-

"""
Uploader for B-Fabric
"""
Expand Down Expand Up @@ -53,29 +51,13 @@
from bfabric.bfabric2 import Bfabric


def setup():
argparser = argparse.ArgumentParser(
description="Arguments for new submitter executable.\nFor more details run: ./bfabric_upload_submitter_executable.py --help"
)
argparser.add_argument("filename", type=str, help="Bash executable of the submitter")
argparser.add_argument(
"engine",
type=str,
choices=["slurm", "gridengine"],
help="Valid engines for job handling are: slurm, gridengine",
)
argparser.add_argument("--name", type=str, help="Name of the submitter", required=False)
argparser.add_argument("--description", type=str, help="Description about the submitter", required=False)
return argparser.parse_args()


def main_upload_submitter_executable(options) -> None:
executableFileName = options.filename
engine = options.engine

client = Bfabric.from_config(verbose=True)

with open(executableFileName, "r") as f:
with open(executableFileName) as f:
executable = f.read()

attr = {
Expand Down Expand Up @@ -134,19 +116,26 @@ def main_upload_submitter_executable(options) -> None:

if options.name:
attr["name"] = options.name
else:
pass
if options.description:
attr["description"] = options.description
else:
pass

res = client.save("executable", attr)
print(yaml.dump(res))


def main() -> None:
options = setup()
"""Parses command line arguments and calls `main_upload_submitter_executable`."""
parser = argparse.ArgumentParser()
parser.add_argument("filename", type=str, help="Bash executable of the submitter")
parser.add_argument(
"engine",
type=str,
choices=["slurm", "gridengine"],
help="Valid engines for job handling are: slurm, gridengine",
)
parser.add_argument("--name", type=str, help="Name of the submitter", required=False)
parser.add_argument("--description", type=str, help="Description about the submitter", required=False)
options = parser.parse_args()
main(options)


Expand Down

0 comments on commit cad6c60

Please sign in to comment.