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

Read and write a model's tasks to config files #116

Merged
merged 5 commits into from
Jun 28, 2021

Conversation

alex-simm
Copy link
Collaborator

@alex-simm alex-simm commented Jun 24, 2021

What

When a model is written to or read from a configuration file, the tasks are formatted and parsed, too.

Why

Fixes #18

How

Almost the same as it is done for the qubits and couplings in a model. There's a list of possible classes in tasks.py:task_lib and instances are created by passing the parsed dictionaries to the classes' constructors in the params argument. As far as I can see, adding that argument doesn't create any conflict with the normal usage of the constructors.

test/test_model.cfg Outdated Show resolved Hide resolved
@nwittler nwittler self-requested a review June 25, 2021 14:03
@codecov
Copy link

codecov bot commented Jun 26, 2021

Codecov Report

Merging #116 (4717124) into dev (31e96be) will increase coverage by 0.16%.
The diff coverage is 90.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #116      +/-   ##
==========================================
+ Coverage   58.44%   58.61%   +0.16%     
==========================================
  Files          36       36              
  Lines        5304     5325      +21     
==========================================
+ Hits         3100     3121      +21     
  Misses       2204     2204              
Impacted Files Coverage Δ
c3/libraries/tasks.py 54.83% <88.23%> (+9.55%) ⬆️
c3/model.py 73.88% <92.30%> (+0.70%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 31e96be...4717124. Read the comment docs.

@lazyoracle lazyoracle added this to the 1.3 milestone Jun 26, 2021
@lazyoracle
Copy link
Member

@alex-simm I pushed some commits to fix the failing tests (as explained by @nwittler). I think this PR is ready to be merged now. Please remember to do a git pull before making further changes to this branch to incorporate my commits in your local repo.

Copy link
Member

@lazyoracle lazyoracle left a comment

Choose a reason for hiding this comment

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

Ready to merge!

@alex-simm
Copy link
Collaborator Author

@alex-simm I pushed some commits to fix the failing tests (as explained by @nwittler). I think this PR is ready to be merged now. Please remember to do a git pull before making further changes to this branch to incorporate my commits in your local repo.

@alex-simm alex-simm closed this Jun 26, 2021
@alex-simm alex-simm reopened this Jun 26, 2021
@alex-simm
Copy link
Collaborator Author

Great thanks, I didn't notice the other test was failing.

@alex-simm
Copy link
Collaborator Author

Do the codeclimate issues need to be fixed? The fromdict function doesn't look too complex for me.

@lazyoracle
Copy link
Member

Do the codeclimate issues need to be fixed? The fromdict function doesn't look too complex for me.

No they aren't a result of your edits, so I guess we fix them some other time.

@lazyoracle lazyoracle merged commit 7e8c141 into q-optimize:dev Jun 28, 2021
@alex-simm alex-simm deleted the tasks-read-config branch August 3, 2021 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

read_config() does not parse tasks when creating Model objects
3 participants