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 optimizations list #114

Merged
merged 14 commits into from
Jul 12, 2022
Merged

Add optimizations list #114

merged 14 commits into from
Jul 12, 2022

Conversation

ColasPinson
Copy link
Collaborator

This PR adds information about optimizations run by the user as a list.

Copy link
Collaborator

@relf relf left a comment

Choose a reason for hiding this comment

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

Ok that's pretty interesting

<td><%= optimization_request.owner.login %></td>
<td><%= optimization_request.kind %></td>
<td><%= optimization_request.outputs["status"] ? optimization_request.outputs["status"] : "Empty" %></td>
<td><%= optimization_request.inputs.empty? ? "0" : optimization_request.inputs["x"].length %></td>
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should create a method nb_of_evaluations in the Optimization model

@@ -154,4 +154,18 @@ def log_error(err_msg)
def raise_error(err_msg)
raise OptimizationError.new(err_msg)
end

def nb_points
return self.inputs.empty? ? "0" : self.inputs["x"].length
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi Nicolas. You can remove return. In Ruby, the return keyword is optional when returning at the end of a function and in practice is only used when returning earlier.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I forgot, thank you for reminding me, I will fix this.

@relf relf added this to In progress in Optimizations Management Jul 1, 2022
@relf relf removed this from In progress in Optimizations Management Jul 1, 2022
ColasPinson and others added 2 commits July 1, 2022 13:24
Removed the returns in the optimization model
self.inputs.empty? ? "0" : self.inputs["x"].length
end

def status_text
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually this kind of methods are helpers for views and are rather located in a Ruby module under app/helpers.


def status_text
status_text = {
-2 => "Unkown_Error",
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is better to create ruby constants in Optimization like (UNKNOWN_ERROR_STATUS = -2, etc.) to avoid "magic number" effect. It appears much verbose at first but definitely better in the long run.

@@ -21,3 +21,8 @@ user4:
login: davina
email: davina.davis@onera.fr
api_key: FriendlyApiKeyUser4

user5:
Copy link
Collaborator

Choose a reason for hiding this comment

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

By adding this user, it changes the result of the test related to the search of candidates for being added as a member of an analysis among the available users.

You have to modify the test controllers/api/v1/user_roles_controller_test.rb line 34: assert_equal [admin.id, user5.id, user2.id], resp.map{|u| u["id"]} with adding before user5 = users(:user5)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for the fix, it worked.

@@ -58,6 +58,14 @@ users_roles_optim_ackley2d:
user: user1
role: owner_optim_ackley2d_role

users_roles_optim_unexpected_id:
user: user5
role: owner_optim_unexpected_id_role
Copy link
Collaborator

Choose a reason for hiding this comment

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

This role and the one below are mentioned here but not defined in roles.yml

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 escaped my search, thank you, they are now properly defined.

@@ -1,3 +1,13 @@
optim_ackley2d:
id: 2
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is,no need to specify id. Ids are assigned automatically.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good to know, thank you !


optim_unexpected_id:
id: -2.28
Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed there is no such thing as an id being equal to -2.28! Not sure why you need that.

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 tried to find every test i could think of, but if the ids are completely secure, no need to check for unexpected id, I agree.

@relf relf merged commit 6634d0b into whatsopt:master Jul 12, 2022
@ColasPinson ColasPinson deleted the optim-list branch July 12, 2022 07:22
This was referenced Jul 12, 2022
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.

None yet

2 participants