Launch Manager loads the new configuration file#248
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
|
Please lnk corresponding issue/bug. |
f13cffe to
eb807a1
Compare
|
The created documentation from the pull request is available at: docu-html |
cd95b35 to
c2e120c
Compare
| bool is_sup = (props.application_profile.application_type == ApplicationType::ReportingAndSupervised || | ||
| props.application_profile.application_type == ApplicationType::StateManager); | ||
| if (is_sup && env_index < static_cast<size_t>(score::lcm::internal::kMaxEnv)) { | ||
| std::string iface_path = "LCM_ALIVE_INTERFACE_PATH=" + score::lcm::internal::aliveInterfacePath(comp.name); |
There was a problem hiding this comment.
we could also add a constant for the env name
| ? score::lcm::ProcessState::kRunning | ||
| : score::lcm::ProcessState::kTerminated; | ||
| } | ||
| } |
There was a problem hiding this comment.
here is a possible error case. In case the configured dependency does not actually exist
| pgm.number_of_restart_attempts = deploy.ready_recovery_action->number_of_attempts; | ||
| } | ||
|
|
||
| for (const auto& dep_name : props.depends_on) { |
There was a problem hiding this comment.
depends_on might also contain a run_target and not only a component.
Special Case: This may be also the fallback_run_target
| } | ||
| } | ||
| auto rt_it = run_target_by_name.find(dep_name); | ||
| if (rt_it != run_target_by_name.end()) { |
There was a problem hiding this comment.
I think depends_on might also refer to fallback_run_target which is currently not in the run_target_by_name map
| run_target_by_name[rt.name] = &rt; | ||
| } | ||
|
|
||
| std::map<std::string, const ComponentConfig*> component_by_name; |
There was a problem hiding this comment.
component_by_name exists twice in this class
| std::set<std::string>& visited) { | ||
| if (!visited.insert(dep_name).second) return; | ||
| auto comp_it = component_to_process_index.find(dep_name); | ||
| if (comp_it != component_to_process_index.end()) { |
There was a problem hiding this comment.
There might be some possible error cases when component/runTarget names are not found because they have not been configured
There was a problem hiding this comment.
Maybe we keep the current validation in the python script and just put asserts in the code for these error cases
| component_by_name[comp.name] = ∁ | ||
| } | ||
|
|
||
| std::function<void(const std::string&, std::vector<uint32_t>&, std::set<std::string>&)> resolve_depends; |
There was a problem hiding this comment.
Maybe it could make sense to have a dedicated Visitor class for this
| } | ||
|
|
||
| void ConfigurationAdapter::resolveDependencyIndexes(std::vector<OsProcess>& processes) { | ||
| for (auto& proc : processes) { |
| component_by_name[comp.name] = ∁ | ||
| } | ||
|
|
||
| std::map<std::string, uint32_t> component_to_process_index; |
There was a problem hiding this comment.
should we build these maps once during initialize and store them as private member?
| if (pg) { | ||
| if (index < pg->processes_.size()) { | ||
| return pg; | ||
| } |
There was a problem hiding this comment.
does not make sense to validate the index here
|
|
||
| static const uint32_t kDefaultProcessExecutionError; | ||
| static uint32_t kDefaultProcessorAffinityMask(); | ||
| static const int32_t kDefaultSchedulingPolicy; |
There was a problem hiding this comment.
These defaults seem obsolete now
- Load new launch manager config - Introduce adapters to make the rest of the code work with the new configuration content - Changes are avaible using --//config:use_new_configuration=True
25f0e94 to
016b719
Compare
| bool_flag( | ||
| name = "use_new_configuration", | ||
| build_setting_default = False, | ||
| visibility = ["//visibility:public"], |
There was a problem hiding this comment.
Should we make this visibility private?
I assume this is an internal flag for development
| /// @return Pointer to the ConfigurationManager object. | ||
| ConfigurationManager* getConfigurationManager(); | ||
| /// @brief Gets the configuration. | ||
| /// @return Pointer to the configuration object. |
There was a problem hiding this comment.
I guess this belongs to ConfigurationType* getConfiguration(); from above
| new_config["initial_run_target"] = config["initial_run_target"] | ||
|
|
||
| if "fallback_run_target" in config: | ||
| fallback_defaults = { |
There was a problem hiding this comment.
what was the reason for not having this in the default dictionary at the top?
| deployment = { | ||
| "ready_timeout": depl_cfg["ready_timeout"], | ||
| "shutdown_timeout": depl_cfg["shutdown_timeout"], | ||
| "bin_dir": depl_cfg.get("bin_dir", "/opt"), |
There was a problem hiding this comment.
There are already defaults for bin_dir and working_dir.
I wonder if we should avoid repeating this here.
| } | ||
|
|
||
| watchdog_config = config.get("watchdog", {}) | ||
| if watchdog_config and "device_file_path" in watchdog_config: |
There was a problem hiding this comment.
I wonder why checking specifically for device_file_path?
Ideally, device_file_path and max_timeout should be mandatory in the schema if a watchdog is defined at all. But currently, it is not.
|
|
||
|
|
||
| def output_filename(input_filename): | ||
| return "launch_manager_config_gen.json" |
There was a problem hiding this comment.
Can we make this depending on the input filename?
| schema = ctx.file.schema | ||
| script = ctx.executable.script | ||
| json_out_dir = ctx.attr.json_out_dir | ||
| use_new_format = ctx.attr.use_new_format |
There was a problem hiding this comment.
Would it be possible to simplify the variant handling here to just always generate all the configs?
The naming should never conflict as we have fixed names for the old config.
Then we are able to have the test cases for the config generation valid for both old and new config until the old config is removed
Closes: #209