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

Add to to_dict functions to Destination and TagSetManager classes #119

Merged
merged 6 commits into from
Jan 17, 2024

Conversation

pauldg
Copy link
Contributor

@pauldg pauldg commented Nov 20, 2023

These functions allow a dict representation of Destination objects which is convenient for example for serializebility

Copy link
Member

@nuwang nuwang left a comment

Choose a reason for hiding this comment

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

@pauldg Would you be able to add a test for this? Something like:

original_entity = # some original entity
serialized_entity = original_entity.to_dict()
deserialized_entity = Entity.from_dict(serialized_entity)
assert deserialized_entity == original_entity

Copy link
Member

@nuwang nuwang 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 these changes @pauldg. Some minor issues, I'll try to fix them tomorrow unless you get to them first.

deserialized_destination = Destination.from_dict(loader, serialized_destination)
# make sure the deserialized destination is the same as the original
self.assertEqual(deserialized_destination, destination)
assert deserialized_destination == destination
Copy link
Member

Choose a reason for hiding this comment

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

The assertEqual above should do the same thing, so I think it's ok to remove this.

Suggested change
assert deserialized_destination == destination

Comment on lines 612 to 617
'min_accepted_cores': self.min_accepted_cores,
'min_accepted_mem': self.min_accepted_mem,
'min_accepted_gpus': self.min_accepted_gpus,
'max_accepted_cores': self.max_accepted_cores,
'max_accepted_mem': self.max_accepted_mem,
'max_accepted_gpus': self.max_accepted_gpus,
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be split I think, otherwise, the superclass method will be aware of its subclasses. The min_accepted related fields should go to the Destination class, and rules should go to the EntityWithRules class.

@nuwang nuwang added the enhancement New feature or request label Jan 17, 2024
@nuwang nuwang merged commit dc2a19a into galaxyproject:main Jan 17, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants