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

pass instances #34

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

DE0CH
Copy link
Collaborator

@DE0CH DE0CH commented Jan 9, 2023

This is #30 with main as the base.

Closes #29.

@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2023

Codecov Report

Merging #34 (5d18b8a) into main (fb16f87) will decrease coverage by 0.42%.
The diff coverage is 87.50%.

@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
- Coverage   92.11%   91.68%   -0.43%     
==========================================
  Files          12       12              
  Lines         431      469      +38     
==========================================
+ Hits          397      430      +33     
- Misses         34       39       +5     
Impacted Files Coverage Δ
tests/test_data_passable.py 87.50% <84.37%> (-6.25%) ⬇️
src/irace/__init__.py 90.07% <100.00%> (+0.47%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@DE0CH DE0CH force-pushed the pass-instance-pre branch from 0d2ba37 to 5d18b8a Compare January 9, 2023 07:14
q = Queue()
scenario = dict(
instances = [q],
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would an instance be a Queue? What is this testing? Could you add a testcase that is more realistic, like instances being a list of functions that need to me minimized?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's because Queue is not serializable and can only work if the queue on the other hand shares the same memory address.

Copy link
Contributor

Choose a reason for hiding this comment

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

But why pass it in "instances" and not via other way? You are using "instances" for something that is not its purpose.
Does this need to be part of the scenario?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess it doesn't need to be. But I think it's nice if there are multiple ways to pass stuff around.

logFile = "",
seed = 123,
instanceObjectSerializer = lambda x: 'hello world'
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this doing? Could you document it somewhere?

Irace is extremely well documented and most of its documentation currently applies to iracepy. See: https://mlopez-ibanez.github.io/irace/ and https://mlopez-ibanez.github.io/irace/irace-package.pdf

self.context.update({
'py_instances': self.scenario['instances'],
})
self.scenario['instances'] = StrVector(list(map(lambda x: json.dumps(x, skipkeys=True, default=self.scenario.get('instanceObjectSerializer', lambda x: '<not serializable>')), self.scenario['instances'])))
Copy link
Contributor

@MLopez-Ibanez MLopez-Ibanez Jan 18, 2023

Choose a reason for hiding this comment

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

Does this mean that the serializer is applied to strings and integers? Isn't that a waste?

Also, could you document with a comment what this line is doing? It seems to replace the instance with the string '<not serializable>' unless the user provides an 'instanceObjectSerializer'. Is that the case? If so, how can the user serialize their instances? It is unclear to me how all this works and will be used in practice.

A couple of examples using for example:

@DE0CH
Copy link
Collaborator Author

DE0CH commented Jan 19, 2023

Ok. I will make the changes. But can you first decide if you will accept PR #22? It’s hard for me to maintain two separate branches.

@MLopez-Ibanez
Copy link
Contributor

Ok. I will make the changes. But can you first decide if you will accept PR #22? It’s hard for me to maintain two separate branches.

It is a lot of new code whose purpose is not completely clear to me.

One problem is that we have only 1 scenario in iracepy, which is the dual-annealing.py. It would be useful for testing and for development to have more varied scenarios.

It is also not an alternative to the current code (so if it stops working or prevents more common uses of irace, we could delete it or ignore it). Instead, it completely replaces the current code, which means that getting back to the iracepy we have now will be a lot of work.

Having two branches, one more experimental and another stable seems like a good idea to me.

@MLopez-Ibanez
Copy link
Contributor

But if you intend to work on iracepy in the long term and not just for the current project, I'm happy to make a fork of the current state as my personal "stable" branch, and then you can take over the main repository. I don't want to stop you from making progress.

@DE0CH
Copy link
Collaborator Author

DE0CH commented Jan 19, 2023

Having two branches, one more experimental and another stable seems like a good idea to me.

Can we fork a branch called 1.0.x where we keep everything stable and use main for more experimental stuff while aiming for 2.0?

But if you intend to work on iracepy in the long term and not just for the current project, I'm happy to make a fork of the current state as my personal "stable" branch, and then you can take over the main repository. I don't want to stop you from making progress.

Thanks. I am probably not going to work on it in the long term. Though, I have some questions about how I should structure my code for the current project. If I start depending on features introduced in PRs that are eventually rejected, then it would mean a lot of refactoring for the project code. So should I just not write new features into irace or iracepy and write any wrapper code in the project itself?

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.

Swaping the irace instances with python objects
3 participants