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

Formatting upgrades #18

Merged
merged 4 commits into from
Jun 1, 2018
Merged

Formatting upgrades #18

merged 4 commits into from
Jun 1, 2018

Conversation

lsorber
Copy link
Member

@lsorber lsorber commented May 31, 2018

  • Autopep8 formatting.
  • Flake8 valid with --max-complexity=10.
  • isort formatting.
  • Improved logging: logging.INFO by default + better formatting + fixed small logging bug.
  • Fix two bugs in get_hash: (1) task graph constants may in fact be dependencies instead of arguments, in which case they should be added to the dephash_list, (2) undid adding of dependency hashes to the arghash_list in order to make interpreting hash misses easier to reason about (args=literals, deps=dependencies).
  • Simplified interface: graphchain.optimize and graphchain.get.

This is what the new logging output looks like:

import graphchain, logging
logging.getLogger("graphchain").setLevel(logging.DEBUG)

dsk = {'a':1, 'b': 'a', 'c': 'b'}
graphchain.get(dsk, 'c')

# 2018-05-31 23:44:03,523 graphchain INFO Initializing cache
# 2018-05-31 23:44:03,523 graphchain INFO Initializing graphchain.json
# 2018-05-31 23:44:03,524 graphchain DEBUG CACHE MISS for key=a with src=NONE arg=NONE dep=NONE (0 candidates)
# 2018-05-31 23:44:03,525 graphchain DEBUG CACHE MISS for key=b with src= HIT arg=MISS dep=MISS (1 candidates)
# 2018-05-31 23:44:03,525 graphchain DEBUG CACHE MISS for key=c with src= HIT arg= HIT dep=MISS (1 candidates)
# 2018-05-31 23:44:03,525 graphchain DEBUG CACHE MISS for key=c with src= HIT arg=MISS dep=MISS (1 candidates)
# 2018-05-31 23:44:03,526 graphchain INFO EXECUTE + STORE key=c literal=<class 'str'>
# 'b'

graphchain.get(dsk, 'c')
# 2018-05-31 23:45:14,825 graphchain DEBUG CACHE MISS for key=a with src= HIT arg=MISS dep=MISS (1 candidates)
# 2018-05-31 23:45:14,826 graphchain DEBUG CACHE MISS for key=b with src= HIT arg= HIT dep=MISS (1 candidates)
# 2018-05-31 23:45:14,826 graphchain DEBUG CACHE MISS for key=b with src= HIT arg=MISS dep=MISS (1 candidates)
# 2018-05-31 23:45:14,826 graphchain INFO LOAD key=c literal=<class 'str'>
# 'b'

(Note that the output in the above examples is incorrect because of #16. The point is to show the logging output.)

@lsorber
Copy link
Member Author

lsorber commented May 31, 2018

@zgornel Most of the diffs are due to the autoformatting. I'm aware this makes reviewing harder, sorry about that :$. But check out the changelog and look for those changes, we can discuss the rest together!

@lsorber lsorber requested a review from zgornel May 31, 2018 21:56
@lsorber lsorber self-assigned this May 31, 2018
Copy link
Contributor

@zgornel zgornel left a comment

Choose a reason for hiding this comment

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

Looks good, nothing to add ;)

@zgornel zgornel merged commit e789b4d into master Jun 1, 2018
@zgornel zgornel deleted the ls-upgrades branch June 1, 2018 08:34
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.

2 participants