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

sim-cli: source simulation file from data directory #132

Merged
merged 2 commits into from
Nov 20, 2023

Conversation

okjodom
Copy link
Collaborator

@okjodom okjodom commented Oct 6, 2023

Introduces SIM_LN_DATA_DIR from which sim-cli sources simulation files and writes simulation outputs.

Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

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

Concept ACK, adding a data dir is super useful (esp in the docker context).

I do think we should think about the power of defaults / making the "getting started" journey as simple as possible with this change, specifically:

  • Assume sim.json to be the default simulation file unless otherwise specified.
  • Assume working directory to be the default data dir unless otherwise specified.

This makes for some quite nice options IMO:

  • sim-cli -> looks for simulation file in {pwd}/sim.json
  • sim-cli my-sim.json -> looks for simulation file at {pwd}/my-sim.json
  • sim-cli --data-dir=/Usr/simulations -> looks for simulation file at /Usr/simulations/sim.json
  • sim-cli my-sim.json --data-dir=/Usr/simulations -> looks for simulation file at /Usr/simulations/my-sim.json

I also really like having the selection option, which we can use to present other json files if we can't find the default value we were expecting.

sim-cli/src/main.rs Outdated Show resolved Hide resolved
sim-cli/src/main.rs Outdated Show resolved Hide resolved
@okjodom
Copy link
Collaborator Author

okjodom commented Nov 6, 2023

Changes proposed introduce simln data dir, but I did not configure this to work with docker set up.
@Extheoisah, do you want to collab as part of #136

@okjodom okjodom marked this pull request as ready for review November 6, 2023 00:13
@Extheoisah
Copy link
Contributor

Changes proposed introduce simln data dir, but I did not configure this to work with docker set up. @Extheoisah, do you want to collab as part of #136

Sure @okjodom
I'll also review the pr.

Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

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

tACK, very nice improvement.

Just wondering about turning that arg into a flag, I can be convinced in either direction.

sim-cli/Cargo.toml Show resolved Hide resolved
sim-lib/src/lib.rs Outdated Show resolved Hide resolved
sim-lib/src/lib.rs Outdated Show resolved Hide resolved
sim-cli/src/main.rs Outdated Show resolved Hide resolved
@carlaKC
Copy link
Contributor

carlaKC commented Nov 15, 2023

@Extheoisah could you take a look to make sure this is going to work for docker-land and then we'll merge?

Also could use an update to the readme to explain these new snazzy features, I'm also happy to do that in a followup :)

sim-cli/src/main.rs Outdated Show resolved Hide resolved
sim-cli/src/main.rs Outdated Show resolved Hide resolved
sim-cli/src/main.rs Outdated Show resolved Hide resolved
sim-lib/src/lib.rs Outdated Show resolved Hide resolved
sim-cli/src/main.rs Outdated Show resolved Hide resolved
@okjodom
Copy link
Collaborator Author

okjodom commented Nov 15, 2023

@sr-gi, in regards to your perspective against how this PR proposes to change how we source sim_file, I could consider a smaller proposal that only introduces data_dir for purposes of storing result outputs.

I'm excited about the new UX that always expects sim_file in data_dir and the helper ergonomics for picking one among many sim files, but I'll only push this if the UX is helpful and necessary.

Comments one, two and three are easy resolved if we can agree to change/preserve UX for passing sim_file to the cli

@sr-gi
Copy link
Member

sr-gi commented Nov 15, 2023

@sr-gi, in regards to your perspective against how this PR proposes to change how we source sim_file, I could consider a smaller proposal that only introduces data_dir for purposes of storing result outputs.

I'm excited about the new UX that always expects sim_file in data_dir and the helper ergonomics for picking one among many sim files, but I'll only push this if the UX is helpful and necessary.

Comments one, two and three are easy resolved if we can agree to change/preserve UX for passing sim_file to the cli

I'm open to being convinced if you and @carlaKC find this useful. It is just not the way I'd approach it

@okjodom okjodom force-pushed the config-dir branch 2 times, most recently from a3a35ee to 628ec8e Compare November 16, 2023 00:52
@okjodom okjodom requested a review from sr-gi November 16, 2023 00:52
@okjodom
Copy link
Collaborator Author

okjodom commented Nov 16, 2023

I'm open to being convinced if you and @carlaKC find this useful. It is just not the way I'd approach it

Simple is always good. And what we had was simple + limited. I def polished the UX change too much (should have scoped it to just data dir addition) but don't want to take it back because I think users will like it :p

@carlaKC
Copy link
Contributor

carlaKC commented Nov 16, 2023

My 2c would be:

  1. Remove the extension completion, since advanced users will know what it is.
  2. Keep the tab completion and remember to user-test whether people respond to it the next time we do interviews.

@okjodom
Copy link
Collaborator Author

okjodom commented Nov 16, 2023

checked. trimmed out the extension completion

@Extheoisah
Copy link
Contributor

@okjodom @carlaKC just tested the PR with docker and it's broken. I'm working on a PR to fix it. We can merge that after this pr is merged.

@okjodom
Copy link
Collaborator Author

okjodom commented Nov 16, 2023

@okjodom @carlaKC just tested the PR with docker and it's broken. I'm working on a PR to fix it. We can merge that after this pr is merged.

Thanks for the docker help. Lmk if you need to pair on it

@Extheoisah
Copy link
Contributor

I've got it working already. One question though is if we want to have a data-dir for the docker setup? By default, the simulation CSV files are saved in the results folder in docker in the root. thoughts? cc @carlaKC

@okjodom
Copy link
Collaborator Author

okjodom commented Nov 16, 2023

I've got it working already. One question though is if we want to have a data-dir for the docker setup? By default, the simulation CSV files are saved in the results folder in docker in the root. thoughts? cc @carlaKC

Can we treat the data dir treated as a volume and have the csv files saved data_dir/results persistent beyond the containers runtime

@Extheoisah
Copy link
Contributor

Extheoisah commented Nov 16, 2023

I've got it working already. One question though is if we want to have a data-dir for the docker setup? By default, the simulation CSV files are saved in the results folder in docker in the root. thoughts? cc @carlaKC

Can we treat the data dir treated as a volume and have the csv files saved data_dir/results persistent beyond the containers runtime

Yup, just made a pr that does that. I've also fixed the docker volume setup. It wasn't updated when we removed the node type from the sim.json config
pr here -> #159
Screenshot 2023-11-16 at 18 41 31

sim-cli/src/main.rs Outdated Show resolved Hide resolved
sim-cli/src/main.rs Outdated Show resolved Hide resolved
sim-cli/src/main.rs Show resolved Hide resolved
sim-cli/src/main.rs Outdated Show resolved Hide resolved
sim-cli/src/main.rs Outdated Show resolved Hide resolved
sim-cli/src/main.rs Outdated Show resolved Hide resolved
sim-cli/src/main.rs Outdated Show resolved Hide resolved
sim-cli/src/main.rs Outdated Show resolved Hide resolved
sim-lib/src/lib.rs Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

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

Code comments non-blocking. Would just like to clarify readme further then gg.

sim-cli/src/main.rs Outdated Show resolved Hide resolved
sim-cli/src/main.rs Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

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

🧡 thanks for updating!

Copy link
Member

@sr-gi sr-gi left a comment

Choose a reason for hiding this comment

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

Just one non-blocking nit.

LGTM

sim-cli/src/main.rs Outdated Show resolved Hide resolved
Adds a simln data-dir cli param, but maintains the default value to cwd
Sources the simulation file from this data dir
Prompts the user to select a simulatin file if the default/configured
file is not found
Copy link
Member

@sr-gi sr-gi left a comment

Choose a reason for hiding this comment

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

ACK 9975d8a

Extheoisah added a commit to Extheoisah/sim-ln that referenced this pull request Nov 17, 2023
@carlaKC carlaKC merged commit 6a056fe into bitcoin-dev-project:main Nov 20, 2023
2 checks passed
Extheoisah added a commit to Extheoisah/sim-ln that referenced this pull request Jan 25, 2024
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.

4 participants