camall3n/onager

Prelaunch ++append flag causes jobs.json file corruption

camall3n opened this issue · 0 comments

After calling prelaunch with ++append, we lose the tags for all previous jobs. If any of those jobs were still waiting to run, they fail, because attempting to take the first element of the (command, tag) tuple actually results in taking the first character of the command instead.

Observed behavior:

$ onager prelaunch +command "mycommand" +arg -lr 0.75 0.25 0.075 0.025 +arg --env Pendulum Cartpole Finger Cheetah +jobname foo +tag --agent_tag +tag-args -lr
$ onager prelaunch +command "mycommand" +arg -lr 0.75 0.25 0.075 0.025 +arg --env Walker +jobname foo +tag --agent_tag +tag-args -lr ++append
{
"1": "mycommand -lr 0.75 --env Pendulum --agent_tag foo_1__lr_0.75",
"2": "mycommand -lr 0.25 --env Pendulum --agent_tag foo_2__lr_0.25",
"3": "mycommand -lr 0.075 --env Pendulum --agent_tag foo_3__lr_0.075",
"4": "mycommand -lr 0.025 --env Pendulum --agent_tag foo_4__lr_0.025",
"5": "mycommand -lr 0.75 --env Cartpole --agent_tag foo_5__lr_0.75",
"6": "mycommand -lr 0.25 --env Cartpole --agent_tag foo_6__lr_0.25",
"7": "mycommand -lr 0.075 --env Cartpole --agent_tag foo_7__lr_0.075",
"8": "mycommand -lr 0.025 --env Cartpole --agent_tag foo_8__lr_0.025",
"9": "mycommand -lr 0.75 --env Finger --agent_tag foo_9__lr_0.75",
"10": "mycommand -lr 0.25 --env Finger --agent_tag foo_10__lr_0.25",
"11": "mycommand -lr 0.075 --env Finger --agent_tag foo_11__lr_0.075",
"12": "mycommand -lr 0.025 --env Finger --agent_tag foo_12__lr_0.025",
"13": "mycommand -lr 0.75 --env Cheetah --agent_tag foo_13__lr_0.75",
"14": "mycommand -lr 0.25 --env Cheetah --agent_tag foo_14__lr_0.25",
"15": "mycommand -lr 0.075 --env Cheetah --agent_tag foo_15__lr_0.075",
"16": "mycommand -lr 0.025 --env Cheetah --agent_tag foo_16__lr_0.025",
"17": ["mycommand -lr 0.75 --env Walker --agent_tag foo_17__lr_0.75", "foo_17__lr_0.75"],
"18": ["mycommand -lr 0.25 --env Walker --agent_tag foo_18__lr_0.25", "foo_18__lr_0.25"],
"19": ["mycommand -lr 0.075 --env Walker --agent_tag foo_19__lr_0.075", "foo_19__lr_0.075"],
"20": ["mycommand -lr 0.025 --env Walker --agent_tag foo_20__lr_0.025", "foo_20__lr_0.025"]
}

Expected behavior, same as below:

onager prelaunch +command "mycommand" +arg -lr 0.75 0.25 0.075 0.025 +arg --env Pendulum Cartpole Finger Cheetah Walker +jobname foo +tag --agent_tag +tag-args -lr
{
"1": ["mycommand -lr 0.75 --env Pendulum --agent_tag foo_1__lr_0.75", "foo_1__lr_0.75"],
"2": ["mycommand -lr 0.25 --env Pendulum --agent_tag foo_2__lr_0.25", "foo_2__lr_0.25"],
"3": ["mycommand -lr 0.075 --env Pendulum --agent_tag foo_3__lr_0.075", "foo_3__lr_0.75"],
"4": ["mycommand -lr 0.025 --env Pendulum --agent_tag foo_4__lr_0.025", "foo_4__lr_0.25"],
"5": ["mycommand -lr 0.75 --env Cartpole --agent_tag foo_5__lr_0.75", "foo_5__lr_0.75"],
"6": ["mycommand -lr 0.25 --env Cartpole --agent_tag foo_6__lr_0.25", "foo_6__lr_0.25"],
"7": ["mycommand -lr 0.075 --env Cartpole --agent_tag foo_7__lr_0.075", "foo_7__lr_0.75"],
"8": ["mycommand -lr 0.025 --env Cartpole --agent_tag foo_8__lr_0.025", "foo_8__lr_0.25"],
"9": ["mycommand -lr 0.75 --env Finger --agent_tag foo_9__lr_0.75", "foo_9__lr_0.75"],
"10": ["mycommand -lr 0.25 --env Finger --agent_tag foo_10__lr_0.25", "foo_10__lr_0.25"],
"11": ["mycommand -lr 0.075 --env Finger --agent_tag foo_11__lr_0.075", "foo_11__lr_0.75"],
"12": ["mycommand -lr 0.025 --env Finger --agent_tag foo_12__lr_0.025", "foo_12__lr_0.25"],
"13": ["mycommand -lr 0.75 --env Cheetah --agent_tag foo_13__lr_0.75", "foo_13__lr_0.75"],
"14": ["mycommand -lr 0.25 --env Cheetah --agent_tag foo_14__lr_0.25", "foo_14__lr_0.25"],
"15": ["mycommand -lr 0.075 --env Cheetah --agent_tag foo_15__lr_0.075", "foo_15__lr_0.75"],
"16": ["mycommand -lr 0.025 --env Cheetah --agent_tag foo_16__lr_0.025", "foo_16__lr_0.25"],
"17": ["mycommand -lr 0.75 --env Walker --agent_tag foo_17__lr_0.75", "foo_17__lr_0.75"],
"18": ["mycommand -lr 0.25 --env Walker --agent_tag foo_18__lr_0.25", "foo_18__lr_0.25"],
"19": ["mycommand -lr 0.075 --env Walker --agent_tag foo_19__lr_0.075", "foo_19__lr_0.75"],
"20": ["mycommand -lr 0.025 --env Walker --agent_tag foo_20__lr_0.025", "foo_20__lr_0.25"]
}