Skip to content

Commit

Permalink
MNT: refactor to separate main command logic from parser creation
Browse files Browse the repository at this point in the history
  • Loading branch information
tangkong committed Sep 18, 2024
1 parent aa5e2a8 commit c9381df
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
20 changes: 3 additions & 17 deletions beams/bin/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

import argparse
import logging
from pathlib import Path

from beams.tree_config import get_tree_from_path

logger = logging.getLogger(__name__)

Expand All @@ -30,17 +27,6 @@ def build_arg_parser(argparser=None):
)


def main(filepath: str):
logger.info(f"Running behavior tree at {filepath}")
# grab config
fp = Path(filepath).resolve()
if not fp.is_file():
raise ValueError("Provided filepath is not a file")

tree = get_tree_from_path(fp)
print(tree)
# TODO: the rest of whatever we determine the "run" process to be
# run external server?
# setup tree?
# tick?
# settings for ticking? (continuous tick?, as separate process?)
def main(*args, **kwargs):
from beams.bin.run_main import main
main(*args, **kwargs)
26 changes: 26 additions & 0 deletions beams/bin/run_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
Logic for `superscore run` main
"""

import logging
from pathlib import Path

from beams.tree_config import get_tree_from_path

logger = logging.getLogger(__name__)


def main(filepath: str):
logger.info(f"Running behavior tree at {filepath}")
# grab config
fp = Path(filepath).resolve()
if not fp.is_file():
raise ValueError("Provided filepath is not a file")

tree = get_tree_from_path(fp)
print(tree)
# TODO: the rest of whatever we determine the "run" process to be
# run external server?
# setup tree?
# tick?
# settings for ticking? (continuous tick?, as separate process?)

0 comments on commit c9381df

Please sign in to comment.