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

[ENH] Updated clear_drives function and added tests #612

Closed
wants to merge 5 commits into from

Conversation

raj1701
Copy link
Contributor

@raj1701 raj1701 commented Mar 7, 2023

Closes #549
I cherry picked the earlier commit to clear_drives.
Added tests to delete a custom number of drives and all drives
make test passed in local setup

@rythorpe
Copy link
Contributor

rythorpe commented Mar 7, 2023

@raj1701 you have a conflict in test_network.py due to some recent changes we made on master and will need to rebase. Are you comfortable with rebasing on your own, or would you like assistance?

all_drives = net.get_external_drive_names()
drives_to_be_deleted = all_drives[0:2] # Deleting 2 drives in this test
net.clear_drives(drive_names=drives_to_be_deleted)
assert len(net.connectivity) == 15
Copy link
Collaborator

Choose a reason for hiding this comment

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

where do you get this number 15 from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just printed net.connectivity values and got it from there. But I will check out what net.connectivity is and figure out another way to find the values

Copy link
Collaborator

Choose a reason for hiding this comment

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

pick_connection may be helpful. You basically want to check how many connections the drive had before and subtract that from the total number of connections.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wrote my own function for getting connections of an external drive but will move to pick connection.

Also I found a bug in clear_connectivity function. Basically it will work correctly when no arguments are passed, but when drive names are passed to it, it deletes all connections other than the ones which were intended. Basically reverse behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will be more clear once I push the commit.

@codecov-commenter
Copy link

codecov-commenter commented Mar 7, 2023

Codecov Report

Merging #612 (87707f9) into master (a4493c1) will decrease coverage by 0.07%.
The diff coverage is 92.30%.

❗ Current head 87707f9 differs from pull request most recent head 1e05e11. Consider uploading reports for the commit 1e05e11 to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master     #612      +/-   ##
==========================================
- Coverage   92.03%   91.97%   -0.07%     
==========================================
  Files          22       22              
  Lines        4256     4260       +4     
==========================================
+ Hits         3917     3918       +1     
- Misses        339      342       +3     
Impacted Files Coverage Δ
hnn_core/network.py 93.41% <92.30%> (+0.06%) ⬆️
hnn_core/parallel_backends.py 82.22% <0.00%> (-0.84%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@raj1701
Copy link
Contributor Author

raj1701 commented Mar 8, 2023

@rythorpe I will try to rebase on my own. If I get stuck will ask for your help.

@raj1701
Copy link
Contributor Author

raj1701 commented Mar 8, 2023

Hey @rythorpe @jasmainak sorry I got stuck in rebasing and it got messed up a lot. Can I make a new branch and push everything.

@raj1701
Copy link
Contributor Author

raj1701 commented Mar 8, 2023

Sorry for all the mishap. I have opened another pull request for the issue

@jasmainak
Copy link
Collaborator

Normally when this happens, it is better to rename the current branch, create a new branch with the same name and then force push:

$ git branch -m delete_drive_old
$ git checkout master
$ git branch delete_drive
$ git checkout delete_drive

then add your changes to this branch, and finally:

$ git push -f origin delete_drive

@raj1701
Copy link
Contributor Author

raj1701 commented Mar 8, 2023

Thanks. I will keep this in mind

@rythorpe
Copy link
Contributor

rythorpe commented Mar 8, 2023

replaced by #613

@rythorpe rythorpe closed this Mar 8, 2023
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.

show users how to delete drives
4 participants