Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions fireworks/scripts/rlaunch_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ def rlaunch(argv: Optional[Sequence[str]] = None) -> int:
parser.add_argument("--loglvl", help="level to print log messages", default="INFO")
parser.add_argument("-s", "--silencer", help="shortcut to mute log messages", action="store_true")

parser.add_argument("--json", help="Pass launchpad and worker files as json-formatted string", action="store_true")

try:
import argcomplete

Expand All @@ -136,17 +138,25 @@ def rlaunch(argv: Optional[Sequence[str]] = None) -> int:
("launchpad", "-l", False, LAUNCHPAD_LOC),
("fworker", "-w", False, FWORKER_LOC),
]
_validate_config_file_paths(args, cfg_files_to_check)
if not args.json:
_validate_config_file_paths(args, cfg_files_to_check)

args.loglvl = "CRITICAL" if args.silencer else args.loglvl

if args.json:
launchpad_generator = lambda x: LaunchPad.from_format(x, f_format="json")
fworker_generator = lambda x: FWorker.from_format(x, f_format="json")
else:
launchpad_generator = lambda x: LaunchPad.from_file(x)
fworker_generator = lambda x: FWorker.from_file(x)

if args.command == "singleshot" and args.offline:
launchpad = None
else:
launchpad = LaunchPad.from_file(args.launchpad_file) if args.launchpad_file else LaunchPad(strm_lvl=args.loglvl)
launchpad = launchpad_generator(args.launchpad_file) if args.launchpad_file else LaunchPad(strm_lvl=args.loglvl)

if args.fworker_file:
fworker = FWorker.from_file(args.fworker_file)
fworker = fworker_generator(args.fworker_file)
else:
fworker = FWorker()

Expand Down