Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customized plan cannot be captured as in the RASP tutorial example #343

Open
jiaywu-deloitte opened this issue Nov 10, 2020 · 2 comments
Open

Comments

@jiaywu-deloitte
Copy link

I'm running the examples in the RASP tutorial in an environment built from reagent cpu docker image in a MAC OS, and I was trying to replicate this (but just replacing the heuristic plan with a new generated plan):

python serving/examples/ecommerce/customer_simulator.py heuristic.json

I was able to generate an epsilon_greedy_plan.json using the epsilongreedyranker_decision_plan() in example.py, the EpsilonGreedyRanker() in operator.py, and the DecisionPlanBuilder() class in builder.py:

{
    "operators": [
        {
            "name": "EpsilonGreedyRanker_1",
            "op_name": "EpsilonGreedyRanker",
            "input_dep_map": {
                "epsilon": "constant_2",
                "values": "constant_3"
            }
        }
    ],
    "constants": [
        {
            "name": "constant_2",
            "value": {
                "double_value": 0.1
            }
        },
        {
            "name": "constant_3",
            "value": {
                "map_double_value": {
                    "action1": 10.0,
                    "action2": 20.0
                }
            }
        }
    ],
    "num_actions_to_choose": 1,
    "reward_function": "",
    "reward_aggregator": [
        "max"
    ]
}

This plan is now in the same dir as the heuristic plan but running python serving/examples/ecommerce/customer_simulator.py epsilon_greedy_plan.json returned error messages:

E1110 21:29:26.775698  6181 DecisionService.cpp:27] Tried to get a config that doesn't exist: epsilon_greedy_plan.json
E1110 21:29:26.775782  6181 Server.cpp:25] GOT ERROR: Tried to get a config that doesn't exist: epsilon_greedy_plan.json

It seems the getPlan() failed to capture the plan but I'm wondering how to connect customized plans to the server. Is this something related to the export() function in the builder as well as in the main file? Thanks!!

@jiaywu-deloitte
Copy link
Author

I got lucky with this one. I tried to rebuild the environment and found those when restarting the server:

./serving/build/RaspCli --logtostderr
I1111 01:47:07.995352  5652 InMemoryLogJoiner.h:19] Log directory : "/tmp/rasp_logging" does not exist. Created
I1111 01:47:07.996305  5652 DiskConfigProvider.cpp:9] READING CONFIGS FROM serving/examples/ecommerce/plans
I1111 01:47:08.010141  5652 DiskConfigProvider.cpp:48] GOT CONFIG multi_armed_bandit.json AT serving/examples/ecommerce/plans/multi_armed_bandit.json
I1111 01:47:08.011966  5652 DiskConfigProvider.cpp:52] Registered decision config: multi_armed_bandit.json
I1111 01:47:08.025550  5652 DiskConfigProvider.cpp:48] GOT CONFIG contextual_bandit.json AT serving/examples/ecommerce/plans/contextual_bandit.json
I1111 01:47:08.025688  5652 DiskConfigProvider.cpp:52] Registered decision config: contextual_bandit.json
I1111 01:47:08.035871  5652 DiskConfigProvider.cpp:48] GOT CONFIG heuristic.json AT serving/examples/ecommerce/plans/heuristic.json
I1111 01:47:08.035995  5652 DiskConfigProvider.cpp:52] Registered decision config: heuristic.json
I1111 01:47:08.037144  5657 Server.cpp:58] STARTING SERVER

And realized the only chance for the new plan to be captured and registered is when starting the server. So basically every time you generated a new plan, you should put it in this dir: serving/examples/ecommerce/plans and then restart the server.

@r-angi
Copy link

r-angi commented Aug 18, 2021

Is this the way the authors of the library intended for users to serve custom plans with RASP or is this just a temporary solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants