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

update the command line output to behave better #2726

Merged
merged 14 commits into from
Feb 18, 2025
Merged

Conversation

phlptp
Copy link
Member

@phlptp phlptp commented Jan 16, 2025

Summary

If merged this pull request will adjust the output flag for recorders/clone and add capture flag for clone

Proposed changes

@phlptp phlptp requested a review from trevorhardy January 16, 2025 20:26
@trevorhardy
Copy link
Contributor

helics_app clone --capture=Battery --output=battery_clone.json --loglevel=trace fails to produce "battery_clone.json" with the following "helics_cloner.log":

[2025-01-31 11:23:26.704] [console] [trace] Clone_core_fsZRzj (1879048192)[connected]::|| priority_cmd:fed_ack:Clone--131072 from 1
[2025-01-31 11:23:26.705] [console] [trace] Clone (131072)[created]::processing command fed_ack:Clone--131072
clone subcommand
[2025-01-31 11:23:26.705] [console] [trace] Clone_core_fsZRzj (1879048192)[connected]::|| cmd:unknown 937 from -235262
[2025-01-31 11:23:26.706] [console] [trace] Clone_core_fsZRzj (1879048192)[connected]::|| cmd:unknown 942 from 1
[2025-01-31 11:23:26.706] [console] [trace] Clone_core_fsZRzj (1879048192)[connected]::|| cmd:init:From 131072 from 131072
[2025-01-31 11:23:27.158] [console] [trace] Clone_core_fsZRzj (1879048192)[initializing]::|| cmd:init_grant:From 1 from 1
[2025-01-31 11:23:27.158] [console] [trace] Clone (131072)[created]::processing command init_grant:From 1
[2025-01-31 11:23:27.158] [console] [debug] Clone (131072)[initializing]::Granting Initialization
[2025-01-31 11:23:27.158] [console] [debug] Clone (131072)[initializing]::Granted Time=-9223372036.854776
[2025-01-31 11:23:27.158] [console] [trace] Clone (131072)[initializing]::processing command exec_check:From 0
[2025-01-31 11:23:27.158] [console] [trace] Clone_core_fsZRzj (1879048192)[operating]::|| cmd:exec_request:From 131072 from 131072
[2025-01-31 11:23:27.158] [console] [trace] Clone (131072)[initializing]::processing command exec_request:From 131072
[2025-01-31 11:23:27.158] [console] [trace] Clone (131072)[initializing]::processing command exec_check:From 131072
[2025-01-31 11:23:27.158] [console] [debug] Clone (131072)[executing]::Granting Execution
[2025-01-31 11:23:27.158] [console] [debug] Clone (131072)[0]::Granted Time=0
[2025-01-31 11:23:27.158] [console] [trace] Clone (131072)[0]::{"granted_time":0,"requested_time":9223372036.854776, "exec":9223372036.854776, "allow":9223372036.854776, "value":9223372036.854776, "message":9223372036.854776, "minDe":9223372036.854776, "minminDe":9223372036.854776}
[2025-01-31 11:23:27.158] [console] [trace] Clone_core_fsZRzj (1879048192)[operating]::|| cmd:time_request:From (131072) Time(9223372036.854776, 0, 0) to (131072) from 131072
[2025-01-31 11:23:27.158] [console] [trace] Clone (131072)[0]::processing command time_request:From (131072) Time(9223372036.854776, 0, 0) to (131072)
[2025-01-31 11:23:27.158] [console] [debug] Clone (131072)[MAXTIME]::Granted Time=9223372036.854776
[2025-01-31 11:23:27.158] [console] [trace] Clone_core_fsZRzj (1879048192)[operating]::|| cmd:disconnect:From 131072 from 131072
[2025-01-31 11:23:27.159] [console] [trace] Clone (131072)[MAXTIME]::processing command disconnect:From 131072
[2025-01-31 11:23:27.159] [console] [trace] Clone_core_fsZRzj (1879048192)[operating]::|| cmd:disconnect:From 131072 from 131072
[2025-01-31 11:23:27.159] [console] [trace] Clone_core_fsZRzj (1879048192)[terminating]::|| cmd:disconnect core acknowledge:From 1 from 1
[2025-01-31 11:23:27.159] [console] [trace] Clone (131072)[MAXTIME]::processing command disconnect fed acknowledge:From 0
[2025-01-31 11:23:27.159] [console] [debug] Clone (131072)[MAXTIME]::Terminating
[2025-01-31 11:23:27.159] [console] [debug] Clone (131072)[MAXTIME]::Granted Time=9223372036.854776
[2025-01-31 11:23:27.199] [console] [trace] Clone_core_fsZRzj (1879048192)[terminating]::|| cmd:stop:From 0 from 0

@trevorhardy
Copy link
Contributor

helics_recorder recorder_config.txt --output= recorder_output.txt with "recorder_config.txt" of "Battery/EV1_current" running as a part of the fundamental default example produces a "recorder_output.txt" that contains recorded publications (excerpt below). This instantiation command of helics_recorder previously failed; see #2724.

#time 	tag	 type*	 value
60		Battery/EV1_current	double	"4.613610"
120		Battery/EV1_current	"4.604332"
180		Battery/EV1_current	"4.595110"
240		Battery/EV1_current	"4.585944"
300		Battery/EV1_current	"4.576831"
360		Battery/EV1_current	"4.567773"
420		Battery/EV1_current	"4.558769"
480		Battery/EV1_current	"4.549818"
540		Battery/EV1_current	"4.540919"
600		Battery/EV1_current	"4.532072"
660		Battery/EV1_current	"4.523277"
720		Battery/EV1_current	"4.514533"
...

@phlptp
Copy link
Member Author

phlptp commented Feb 13, 2025

@trevorhardy can you check this again?

@trevorhardy
Copy link
Contributor

Pulled down the new commits (7fbb609) and helics_app clone --capture=Battery --output=battery_clone.json --loglevel=trace fails to produce "battery_clone.json" with the following "helics_cloner.log":

[2025-02-14 04:52:04.669] [console] [trace] Clone_core_Ni5a7K (1879048192)[connected]::|| priority_cmd:fed_ack:Clone--131072 from 1
[2025-02-14 04:52:04.670] [console] [trace] Clone (131072)[created]::processing command fed_ack:Clone--131072
clone subcommand
[2025-02-14 04:52:14.284] [console] [trace] Clone_core_Ni5a7K (1879048192)[connected]::|| cmd:tick:From 0 from 0
[2025-02-14 04:52:14.744] [console] [trace] Clone_core_Ni5a7K (1879048192)[connected]::|| cmd:init:From 131072 from 131072
[2025-02-14 04:52:14.747] [console] [trace] Clone_core_Ni5a7K (1879048192)[initializing]::|| cmd:init_grant:From 1 from 1
[2025-02-14 04:52:14.747] [console] [trace] Clone (131072)[created]::processing command init_grant:From 1
[2025-02-14 04:52:14.747] [console] [debug] Clone (131072)[initializing]::Granting Initialization
[2025-02-14 04:52:14.748] [console] [debug] Clone (131072)[initializing]::Granted Time=-9223372036.854776
[2025-02-14 04:52:14.748] [console] [trace] Clone (131072)[initializing]::processing command exec_check:From 0
[2025-02-14 04:52:14.748] [console] [trace] Clone_core_Ni5a7K (1879048192)[operating]::|| cmd:exec_request:From 131072 from 131072
[2025-02-14 04:52:14.748] [console] [trace] Clone (131072)[initializing]::processing command exec_request:From 131072
[2025-02-14 04:52:14.748] [console] [trace] Clone (131072)[initializing]::processing command exec_check:From 131072
[2025-02-14 04:52:14.748] [console] [debug] Clone (131072)[executing]::Granting Execution
[2025-02-14 04:52:14.748] [console] [debug] Clone (131072)[0]::Granted Time=0
[2025-02-14 04:52:14.748] [console] [trace] Clone (131072)[0]::{"granted_time":0,"requested_time":9223372036.854776, "exec":9223372036.854776, "allow":9223372036.854776, "value":9223372036.854776, "message":9223372036.854776, "minDe":9223372036.854776, "minminDe":9223372036.854776}
[2025-02-14 04:52:14.748] [console] [trace] Clone_core_Ni5a7K (1879048192)[operating]::|| cmd:time_request:From (131072) Time(9223372036.854776, 0, 0) to (131072) from 131072
[2025-02-14 04:52:14.748] [console] [trace] Clone (131072)[0]::processing command time_request:From (131072) Time(9223372036.854776, 0, 0) to (131072)
[2025-02-14 04:52:14.748] [console] [debug] Clone (131072)[MAXTIME]::Granted Time=9223372036.854776
[2025-02-14 04:52:14.748] [console] [trace] Clone_core_Ni5a7K (1879048192)[operating]::|| cmd:disconnect:From 131072 from 131072
[2025-02-14 04:52:14.748] [console] [trace] Clone (131072)[MAXTIME]::processing command disconnect:From 131072
[2025-02-14 04:52:14.748] [console] [trace] Clone_core_Ni5a7K (1879048192)[operating]::|| cmd:disconnect:From 131072 from 131072
[2025-02-14 04:52:14.749] [console] [trace] Clone_core_Ni5a7K (1879048192)[terminating]::|| cmd:disconnect core acknowledge:From 1 from 1
[2025-02-14 04:52:14.749] [console] [trace] Clone (131072)[MAXTIME]::processing command disconnect fed acknowledge:From 0
[2025-02-14 04:52:14.749] [console] [debug] Clone (131072)[MAXTIME]::Terminating
[2025-02-14 04:52:14.749] [console] [debug] Clone (131072)[MAXTIME]::Granted Time=9223372036.854776
[2025-02-14 04:52:14.789] [console] [trace] Clone_core_Ni5a7K (1879048192)[terminating]::|| cmd:stop:From 0 from 0

@phlptp
Copy link
Member Author

phlptp commented Feb 14, 2025

@trevorhardy try again?

@trevorhardy
Copy link
Contributor

@phlptp, no luck. The clone output JSON does now have {"defaultglobal":true} instead of being blank.

@phlptp
Copy link
Member Author

phlptp commented Feb 14, 2025

@trevorhardy try again?

@trevorhardy
Copy link
Contributor

That did it! This is the clone output:

{"defaultglobal":true,"event_triggered":false,"extra":"configuration","inputs":[],
"max_iterations":50,"observer":false,"only_transmit_on_change":false,"optional":true,"period":60.0,"points":
[{"key":"Battery/EV1_current","time":60.0,"type":"double","value":"4.613610"},
{"key":"Battery/EV2_current","time":60.0,"type":"double","value":"5.703422"},
{"key":"Battery/EV3_current","time":60.0,"type":"double","value":"2.932551"},
...

Copy link
Contributor

@trevorhardy trevorhardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't comprehensively tested this but I'm not aware of bugs at this time.

@phlptp phlptp requested a review from nightlark February 14, 2025 19:31
@phlptp
Copy link
Member Author

phlptp commented Feb 14, 2025

Fixes #2731

opt->check([](const std::string& fname) {
static const std::set<std::string> validExt = {
".ini", ".toml", ".json", ".INI", ".JSON", ".TOML"};
auto ext = std::filesystem::path(fname).extension().string();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just make the extension lowercase, so we only need to list one variant in the list of valid extensions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that but it seemed like it would be more efficient to just let the set deal with it, rather than call an additional function every time. I tried routing it through the CLI validator that does that but it had some annoying side effects so I went away from that option.

@phlptp phlptp merged commit 3b9d4c7 into develop Feb 18, 2025
17 of 20 checks passed
@phlptp phlptp deleted the output_control branch February 18, 2025 21:48
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

Successfully merging this pull request may close these issues.

3 participants