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

**kwargs extravaganza #439

Closed
wants to merge 12 commits into from

Conversation

adamruzicka
Copy link
Contributor

good enough to make examples/future_execution and examples/orchestrate_evented work

Let's see how many tests will be broken by this

Copy link

@ofedoren ofedoren left a comment

Choose a reason for hiding this comment

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

Thanks, @adamruzicka, the changes look logical, but I don't understand why it raises
NoMethodError: undefined method 'to_hash' for Support::DummyExample::Polling:Class. It seems Support::DummyExample::Polling is Action, which should (?) respond to_hash via recursive_to_hash (?). Obviously something gets broken on a way to serialization, but no idea when.

@@ -70,7 +72,8 @@ def args

# @api private
def self.new_from_hash(world, hash, *args)
serializer = Utils.constantize(hash[:args_serializer]).new(nil, hash[:serialized_args])
puts hash

Choose a reason for hiding this comment

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

debug leftover

@adamruzicka
Copy link
Contributor Author

but I don't understand why it raises
NoMethodError: undefined method 'to_hash' for Support::DummyExample::Polling:Class. It seems Support::DummyExample::Polling is Action, which should (?) respond to_hash via recursive_to_hash (?). Obviously something gets broken on a way to serialization, but no idea when.

Apparently in https://github.com/Dynflow/dynflow/blob/master/lib/dynflow/execution_plan.rb#L287 the last self argument is the execution plan. Because ExecutionPlan implements to_hash, ruby 2.7 implicitly calls it as described in https://bugs.ruby-lang.org/issues/14909

@ofedoren
Copy link

Seems okay-ish?.. I mean, do we need to pass **{}? Does it fail without this on Ruby 2.7?

@adamruzicka
Copy link
Contributor Author

I'm afraid so. In some place we explicitly need to tell ruby to not treat the previous argument as an options hash (and not call to_hash on it) :/

Copy link

@ofedoren ofedoren left a comment

Choose a reason for hiding this comment

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

Thanks, @adamruzicka, I didn't find any issues now, you did incredible work here :D

Just one this inline and I guess it's ready.

@@ -43,7 +43,7 @@ def start
def clean!
plans = @world.persistence.find_old_execution_plans(Time.now.utc - @max_age)
report(plans)
@world.persistence.delete_execution_plans(uuid: plans.map(&:id))
@world.persistence.delete_execution_plans(uuid: plans.map(&:id), **{})
Copy link

Choose a reason for hiding this comment

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

Should we have **{} here? I mean, delete_execution_plans looks to have def delete_execution_plans(filters, batch_size = 1000, backup_dir = nil). It won't hurt, but it just seems unnecessary. On the other hand, I've noticed this: https://github.com/Dynflow/dynflow/blob/master/lib/dynflow/debug/telemetry/persistence.rb#L34-L38. I guess it makes more sense to add **kwargs support there just in case.

@adamruzicka
Copy link
Contributor Author

In the end we decided to not go down this path.

@adamruzicka adamruzicka closed this Apr 4, 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.

2 participants