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

Plugins only recognized if defined in last json file #76

Open
c276 opened this issue Mar 29, 2022 · 2 comments
Open

Plugins only recognized if defined in last json file #76

c276 opened this issue Mar 29, 2022 · 2 comments
Assignees
Labels
bug Something isn't working triage Needs categorization and prioritization

Comments

@c276
Copy link

c276 commented Mar 29, 2022

Given the following 3 config files:

  • first_cloe_config.json:
{
  "version": "4",
  "include": ["second_cloe_config.json"]
}
  • second_cloe_config.json:
{
  "version": "4",
  "include": ["third_cloe_config.json"],
  "plugins": [
    {
      "path": "path/to/my_plugin.so"
    }
  ]
}
  • third_cloe_config.json:
{
  "version": "4",
(...)
}

When calling cloe-engine run first_cloe_config.json, the plugin defined in second_cloe_config.json is not recognized. The same happens if I define the plugin in first_cloe_config.json However, if I define the plugin in third_cloe_config.json, the plugin is recognized.
Is this desired behavior?

@cassava
Copy link
Contributor

cassava commented Apr 25, 2022

Hi @c276, thanks for raising this issue! When you say, "is not recognized", what do mean?

  • Is the plugin ignored?
  • Is the plugin not found?
  • Are you using relative paths for your plugin?
  • See the output of cloe-engine dump first_cloe_config.json to check your assumptions.

Note that if you are using a relative path in your config file, it is relative from the config file that specifies it.

@cassava cassava self-assigned this Apr 25, 2022
@cassava cassava added bug Something isn't working triage Needs categorization and prioritization labels Apr 25, 2022
@c276
Copy link
Author

c276 commented Apr 26, 2022

Hi @cassava, thanks for your reply. I'll try to make the issue clearer:
With "is not recognized", I mean it is not loaded and it is not attempted to be loaded. Also, I use absolute paths. I enhanced my example files to show the error:

  • I moved controller_basic.so from /usr/local/lib/cloe (where I installed cloe) to /urs/local/lib so that it is not recognized by cloe automatically
  • All config files are at the same location.
  • first_cloe_config.json:
{
    "version": "4",
    "include": [
        "second_cloe_config.json"
    ],
    "simulators": [
        {
            "binding": "minimator",
            "args": {
                "vehicles": [
                    "ego"
                ]
            }
        }
    ],
    "vehicles": [
        {
            "name": "default",
            "from": {
                "simulator": "minimator",
                "index": 0
            }
        }
    ],
    "server": {
        "listen": false
    }
}
  • second_cloe_config.json:
{
    "version": "4",
    "include": [
        "third_cloe_config.json"
    ],
    "plugins": [
        {
            "path": "/usr/local/lib/controller_basic.so"
        }
    ]
}
  • third_cloe_config.json:
{
    "version": "4",
    "controllers": [
        {
            "binding": "basic",
            "vehicle": "default"
        }
    ],
    "triggers": [
        {
            "event": "start",
            "action": "log=info: Running smoketest."
        },
        {
            "event": "start",
            "action": "realtime_factor=-1"
        },
        {
            "event": "time=${DURATION-10}",
            "action": "succeed"
        }
    ],
    "logging": [
        {
            "name": "basic",
            "level": "trace"
        }
    ]
}
  • output (at location of config files):
❯ cloe-engine dump first_cloe_config.json
third_cloe_config.json:/controllers/0: unknown factory: basic
    In JSON segment:
        {
          "binding": "basic",
          "vehicle": "default"
        }
    With following JSON schema:
        {
          "oneOf": [
            {
              "additionalProperties": false,
              "properties": {
                "args": null,
                "binding": {
                  "const": "demo_printer",
                  "description": "name of factory"
                },
                "name": {
                  "description": "globally unique identifier for controller",
                  "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$",
                  "type": "string"
                },
                "vehicle": {
                  "description": "vehicle controller is assigned to",
                  "type": "string"
                }
              },
              "required": [
                "binding"
              ],
              "type": "object"
            },
            {
              "additionalProperties": false,
              "properties": {
                "args": {
                  "additionalProperties": false,
                  "properties": {
                    "halt_progress_at": {
                      "description": "time in ns at which to halt all progress",
                      "maximum": 9223372036854775807,
                      "minimum": -9223372036854775808,
                      "type": "integer"
                    },
                    "progress_per_step": {
                      "description": "progress to make each step",
                      "maximum": 9223372036854775807,
                      "minimum": -9223372036854775808,
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "binding": {
                  "const": "demo_stuck",
                  "description": "name of factory"
                },
                "name": {
                  "description": "globally unique identifier for controller",
                  "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$",
                  "type": "string"
                },
                "vehicle": {
                  "description": "vehicle controller is assigned to",
                  "type": "string"
                }
              },
              "required": [
                "binding"
              ],
              "type": "object"
            },
            {
              "additionalProperties": false,
              "properties": {
                "args": {
                  "additionalProperties": false,
                  "properties": {
                    "components": {
                      "description": "array of components to be extracted",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "output_file": {
                      "description": "file path to write groundtruth output to",
                      "type": "string"
                    },
                    "output_type": {
                      "description": "type of output file to write",
                      "enum": [
                        "json.bz2",
                        "json.gz",
                        "json.zip",
                        "json",
                        "msgpack.bz2",
                        "msgpack.gz",
                        "msgpack.zip",
                        "msgpack"
                      ],
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "binding": {
                  "const": "gndtruth_extractor",
                  "description": "name of factory"
                },
                "name": {
                  "description": "globally unique identifier for controller",
                  "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$",
                  "type": "string"
                },
                "vehicle": {
                  "description": "vehicle controller is assigned to",
                  "type": "string"
                }
              },
              "required": [
                "binding"
              ],
              "type": "object"
            },
            {
              "additionalProperties": false,
              "properties": {
                "args": null,
                "binding": {
                  "const": "nop",
                  "description": "name of factory"
                },
                "name": {
                  "description": "globally unique identifier for controller",
                  "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$",
                  "type": "string"
                },
                "vehicle": {
                  "description": "vehicle controller is assigned to",
                  "type": "string"
                }
              },
              "required": [
                "binding"
              ],
              "type": "object"
            },
            {
              "additionalProperties": false,
              "properties": {
                "args": {
                  "additionalProperties": false,
                  "properties": {
                    "init_phase": {
                      "description": "time during which initialization is performed",
                      "maximum": 9223372036854775807,
                      "minimum": -9223372036854775808,
                      "type": "integer"
                    },
                    "lane_sensor_components": {
                      "description": "array of lane-sensor components to be checked",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "binding": {
                  "const": "virtue",
                  "description": "name of factory"
                },
                "name": {
                  "description": "globally unique identifier for controller",
                  "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$",
                  "type": "string"
                },
                "vehicle": {
                  "description": "vehicle controller is assigned to",
                  "type": "string"
                }
              },
              "required": [
                "binding"
              ],
              "type": "object"
            }
          ]
        }

However, if I move the plugin definition in the third file, it works:

  • second_cloe_config.json:
{
    "version": "4",
    "include": [
        "third_cloe_config.json"
    ]
}
  • third_cloe_config.json
{
    "version": "4",
    "plugins": [
        {
            "path": "/usr/local/lib/controller_basic.so"
        }
    ],
    "controllers": [
        {
            "binding": "basic",
            "vehicle": "default"
        }
    ],
    "triggers": [
        {
            "event": "start",
            "action": "log=info: Running smoketest."
        },
        {
            "event": "start",
            "action": "realtime_factor=-1"
        },
        {
            "event": "time=${DURATION-10}",
            "action": "succeed"
        }
    ],
    "logging": [
        {
            "name": "basic",
            "level": "trace"
        }
    ]
}
  • output:
❯ cloe-engine dump first_cloe_config.json
{
  "controllers": [
    {
      "binding": "basic",
      "vehicle": "default"
    }
  ],
  "defaults": {
    "components": [],
    "controllers": [],
    "simulators": []
  },
  "engine": {
    "hooks": {
      "post_disconnect": [],
      "pre_connect": []
    },
    "ignore": [],
    "keep_alive": false,
    "output": {
      "clobber": true,
      "files": {
        "config": "config.json",
        "result": "result.json",
        "triggers": "triggers.json"
      },
      "path": "${CLOE_SIMULATION_UUID}"
    },
    "plugin_path": [
      "/usr/local/lib/cloe",
      "/usr/lib/cloe"
    ],
    "plugins": {
      "allow_clobber": true,
      "ignore_failure": false,
      "ignore_missing": false
    },
    "polling_interval": 100,
    "registry_path": "/home/dockeruser/.local/share/cloe/registry",
    "security": {
      "enable_command_action": false,
      "enable_hooks_section": true,
      "enable_include_section": true,
      "max_include_depth": 64
    },
    "triggers": {
      "ignore_source": false
    },
    "watchdog": {
      "default_timeout": 90000,
      "mode": "off",
      "state_timeouts": {
        "ABORT": 90000,
        "CONNECT": 300000,
        "DISCONNECT": 600000,
        "STOP": 300000
      }
    }
  },
  "logging": [
    {
      "level": "trace",
      "name": "basic"
    }
  ],
  "plugins": [
    {
      "path": "/usr/local/lib/controller_basic.so"
    }
  ],
  "server": {
    "api_prefix": "/api",
    "listen": false,
    "listen_address": "127.0.0.1",
    "listen_port": 8080,
    "listen_threads": 10,
    "static_prefix": ""
  },
  "simulation": {
    "abort_on_controller_failure": true,
    "controller_retry_limit": 1000,
    "controller_retry_sleep": 1,
    "model_step_width": 20000000
  },
  "simulators": [
    {
      "args": {
        "vehicles": [
          "ego"
        ]
      },
      "binding": "minimator"
    }
  ],
  "triggers": [
    {
      "action": "log=info: Running smoketest.",
      "event": "start",
      "source": "filesystem",
      "sticky": false
    },
    {
      "action": "realtime_factor=-1",
      "event": "start",
      "source": "filesystem",
      "sticky": false
    },
    {
      "action": "succeed",
      "event": "time=10",
      "source": "filesystem",
      "sticky": false
    }
  ],
  "vehicles": [
    {
      "components": {},
      "from": {
        "index": 0,
        "simulator": "minimator"
      },
      "name": "default"
    }
  ],
  "version": "4"
}

@cassava cassava added this to the 0.19.0 milestone May 4, 2022
@cassava cassava modified the milestones: 0.19.0, 0.21.0 Mar 30, 2023
@cassava cassava modified the milestones: 0.21.0, 0.22.0 Dec 8, 2023
@cassava cassava modified the milestones: 0.22.0, 0.23.0 Mar 27, 2024
@cassava cassava modified the milestones: 0.23.0, 0.24.0 Apr 23, 2024
@cassava cassava modified the milestones: 0.24.0, 0.25.0 May 6, 2024
@cassava cassava removed this from the 0.25.0 milestone Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Needs categorization and prioritization
Projects
None yet
Development

No branches or pull requests

2 participants