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

Allow to link back to another label for continuation of push #1193

Open
wants to merge 3 commits into
base: push-instead-bud
Choose a base branch
from

Conversation

enescakir
Copy link
Member

@enescakir enescakir commented Feb 6, 2024

Pass hop exception to the custom rspec matcher

We use a custom rspec matcher to verify hop events. In certain tests,
it's necessary to examine the details of the hop exception. Therefore,
we've made a change to pass the hop exception to the rspec helper,
enabling us to check the exception details within the rspec matcher.

Allow to link back to another label for continuation of push

Pushing is becoming popular these days. If you're budding a single prog
and don't require concurrency, push is a better option than bud.

At present, its usage pattern is complex. You need to check the retval
of push in the same label you pushed, then move to the next label.

However, we can simplify this by allowing a link back to another label
for the continuation of push. This way, the pushed program returns the
next label instead of the previous one.

Fixes #1187

@enescakir enescakir self-assigned this Feb 6, 2024
Copy link
Member

@byucesoy byucesoy left a comment

Choose a reason for hiding this comment

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

This looks great overall 👍

@byucesoy
Copy link
Member

PostgresServerNexus::update_superuser_password also has retval check (which is added after this PR)

When we bud a prog, we need to implement an additional label to wait it.
However, when we bud a single prog, we can achieve the same
functionality with pushing. Budding has the power to run multiple
concurrent progs.
We use a custom rspec matcher to verify hop events. In certain tests,
it's necessary to examine the details of the hop exception. Therefore,
we've made a change to pass the hop exception to the rspec helper,
enabling us to check the exception details within the rspec matcher.
Pushing is becoming popular these days. If you're budding a single prog
and don't require concurrency, push is a better option than bud.

At present, its usage pattern is complex. You need to check the retval
of push in the same label you pushed, then move to the next label.

However, we can simplify this by allowing a link back to another label
for the continuation of push. This way, the pushed program returns the
next label instead of the previous one.
@enescakir
Copy link
Member Author

@fdr @byucesoy it's ready to review

@@ -29,6 +27,10 @@ def user
echo #{sshable.keys.map(&:public_key).join("\n").shellescape} | sudo tee /home/rhizome/.ssh/authorized_keys > /dev/null
SH

push Prog::InstallRhizome, {"target_folder" => frame["target_folder"]}
push Prog::InstallRhizome, {"target_folder" => frame["target_folder"]}, next_label: "finish"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wew it's slightly brutal how many strings are in "push", and that we don't have a nice way to avoid free-handing errors in next_label or a way to check them on file load. But, that's for another day. Maybe let's pencil in these renovations for the next quarter. It's one of those sub-legible tasks that's easy to forget. Just planting the seed of a thought here.

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 created a issue for it #1293

Budding and pushing with metaprogramming might be interesting

Copy link
Collaborator

@fdr fdr left a comment

Choose a reason for hiding this comment

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

can next_label be required? maybe the old retval form has no virtues and should be eliminated.

@enescakir
Copy link
Member Author

can next_label be required? maybe the old retval form has no virtues and should be eliminated.

If the prog runs and returns some values, it could be helpful. Of course, we might be able to find an alternative solution.

@enescakir enescakir requested a review from fdr February 27, 2024 11:04
@fdr
Copy link
Collaborator

fdr commented Feb 27, 2024

can next_label be required? maybe the old retval form has no virtues and should be eliminated.

If the prog runs and returns some values, it could be helpful. Of course, we might be able to find an alternative solution.

Can't the continuation also look at retval ? (we could rename it or leave it as a slight abuse of notation)

Copy link
Collaborator

@fdr fdr left a comment

Choose a reason for hiding this comment

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

Just my question on retval/continuation/etc, leaving this review so it clears my query

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

Successfully merging this pull request may close these issues.

None yet

3 participants