Skip to content

Error when trying to run example commands #596

@nhansendev

Description

@nhansendev

When I try running the example commands I am unable to use them as-written:

export CONFIG=reagent/gym/tests/configs/cartpole/discrete_dqn_cartpole_online.yaml
./reagent/workflow/cli.py run reagent.gym.tests.test_gym.run_test $CONFIG

The problem is that my setup (Conda -> Python 3.8 env on Linux) doesn't recognize the command or thinks that I've entered too many parameters. I try to get around this by creating a .py file to run the commands instead like so:

from reagent.workflow.cli import run
import sys

if __name__ == "__main__":
    config_path = '/home/nate/Desktop/Atom/ReAgent/reagent/gym/tests/configs/cartpole/discrete_c51_cartpole_online.yaml'
    action = 'reagent.workflow.gym_batch_rl.offline_gym_random'
    sys.argv += [action, config_path]
    run()

However, this results in an error stating that I haven't provided enough parameters for the config:

Traceback (most recent call last):
  File "/home/nate/Desktop/Atom/ReAgent/test.py", line 12, in <module>
    run()
  File "/home/nate/miniconda3/envs/py_38/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/home/nate/miniconda3/envs/py_38/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/home/nate/miniconda3/envs/py_38/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/nate/miniconda3/envs/py_38/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/nate/Desktop/Atom/ReAgent/reagent/workflow/cli.py", line 82, in run
    config = ConfigClass(**config_dict)
TypeError: __init__() missing 4 required positional arguments: 'env_name', 'pkl_path', 'num_train_transitions', and 'max_steps'

I've checked and the yaml file is being correctly imported, but it does not contain the information being requested.
Clearly I'm doing something wrong. Please let me know how I might address the issue.
I've run tox to check and most items passed, but not all. Could this be a contributing factor?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions