-
Notifications
You must be signed in to change notification settings - Fork 3
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
move execute_insert to top module nesting so pickle does not err #87
Open
kenben
wants to merge
73
commits into
ka/parallel
Choose a base branch
from
ka/parallel_pickle_error
base: ka/parallel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
db2f8ae
initial operator overloading
potash 3f35a15
syntax, when
potash b6cbaaa
real test
potash b25ab25
truediv
potash a5463a4
consistency fix: make sure quantites is a tuple-valued dict
potash 837329d
Fix whitespace issues
mbauman f528951
Update coverage from 4.2 to 4.3.1 (#46)
pyup-bot aef832f
Update pytest from 3.0.4 to 3.0.5 (#44)
pyup-bot 4584d39
Update csvkit from 0.9.1 to 1.0.0 (#43)
pyup-bot 3a61e1c
Update csvkit from 1.0.0 to 1.0.1 (#48)
pyup-bot e21034a
Ep/distinct (#41)
potash eac71bb
Add a categorical helper function
mbauman 51d8d2f
flake8
mbauman 51f1134
Rename categorical to multicompare; create simple MultiCompare subclass
mbauman e3f52a5
support lists of tuples in quantities
mbauman 45029e0
flake8
mbauman 75da2fa
Rename MultiCompare to Compare; introduce Categorical
mbauman f7b0342
Change default include_null behavior to False
mbauman b812dfa
Allow passing include_null shortname as a truthy value
mbauman ded6fb6
Merge pull request #38 from dssg/mb/helpers
potash 7ef0e61
Add non-dev requirements.txt (#32)
mbauman 3389d0a
Ep/refactor spacetime (#49)
potash ae5c8dd
Ep/join table (#50)
potash 4cc018e
Update to v0.2.0
thcrock 5a6033a
get statements before exec
potash 0ab0cb1
merge master
potash c843215
arithmetic
potash e210332
operator_str
potash 5f9e2ac
docstring
potash f6ae852
make interval to accessible to spacetime aggregates
potash 192f133
Be less lazy for Python 2.7
mbauman 8890de1
Support format_kwargs when getting columns of AggregateExpressions
mbauman e29931a
Update coverage from 4.3.1 to 4.3.4 (#54)
pyup-bot a538a13
Update sqlalchemy to 1.1.5 (#55)
pyup-bot ae9458a
Update cryptography from 1.7.1 to 1.7.2 (#58)
pyup-bot 6142a0f
Update tox from 2.5.0 to 2.6.0 (#59)
pyup-bot 6c14f11
Update flake8 from 3.2.1 to 3.3.0 (#60)
pyup-bot 2565473
Update sphinx from 1.5.1 to 1.5.3 (#62)
pyup-bot 8a9325d
Add trivial integration test
mbauman fedd7d1
Merge branch 'master' into ep/aggregate_arithmetic
mbauman 70c90c1
Update sqlalchemy to 1.1.6 (#64)
pyup-bot 260696d
Update psycopg2 from 2.6.2 to 2.7 (#66)
pyup-bot 08542f6
Update pytest from 3.0.5 to 3.0.6 (#65)
pyup-bot 80b8b63
Go back to using the count function
mbauman 23361d8
Update psycopg2 from 2.7 to 2.7.1 (#71)
pyup-bot 4ae3990
Merge pull request #63 from dssg/ep/aggregate_arithmetic
mbauman 2c60460
Update cryptography from 1.7.2 to 1.8.1 (#70)
pyup-bot 48def77
Update pytest from 3.0.6 to 3.0.7 (#73)
pyup-bot b2584fe
Bundle pyupdates, please
mbauman e18d8af
Update sqlalchemy to 1.1.7 (#76)
pyup-bot fd6eb13
Scheduled biweekly dependency update for week 14 (#77)
pyup-bot aee37a8
use filter instead of case when
potash c006e22
unused format kwarg
potash a59ac30
add mode to tests
potash d841725
include order in aggregate name and test it
potash 67f4db2
Whitespace
mbauman 939bcde
Merge pull request #79 from dssg/ep/order_name_bug
mbauman c59866e
Merge pull request #78 from dssg/ep/filter
mbauman cab2476
Add validation and support for restricting the "beginning of time" (#74)
mbauman 82bb17f
Update sqlalchemy from 1.1.8 to 1.1.9
pyup-bot f92e98b
Update sqlalchemy from 1.1.8 to 1.1.9
pyup-bot bc3577e
Update tox from 2.6.0 to 2.7.0
pyup-bot 4acdeaa
Merge pull request #80 from dssg/pyup-scheduled-update-04-17-2017
mbauman 3f9429f
Allow overriding of choice quoting [Resolves #81]
thcrock a1d22ce
Untangle quoting logic, rename quoting argument
thcrock 36a93e2
Merge pull request #83 from dssg/choice_quoting
mbauman 9682010
Don't modify dict during iteration when shortening keys
mbauman 2d97d5a
Merge pull request #84 from dssg/mb/82
mbauman c5d0791
move execute_insert to top module nesting so pickle does not err
cf05dbd
remove that pdb
470ae97
move execute_insert to sql
347da7e
merge master, solve conflict
661d32c
re-add SpacetimeSubQueryAggregation
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,23 @@ | |
from .sql import make_sql_clause, to_sql_name, CreateTableAs, InsertFromSelect | ||
|
||
|
||
def execute_insert(get_engine, insert): | ||
try: | ||
engine = get_engine() | ||
except: | ||
print('Could not connect to the database within spawned process') | ||
raise | ||
|
||
print("Starting parallel process") | ||
|
||
# transaction | ||
with engine.begin() as conn: | ||
conn.execute(insert) | ||
|
||
engine.dispose() | ||
|
||
return True | ||
|
||
|
||
def make_list(a): | ||
return [a] if not isinstance(a, list) else a | ||
|
@@ -284,23 +301,6 @@ def execute(self, conn): | |
conn.execute(self.get_create()) | ||
trans.commit() | ||
|
||
def execute_insert(get_engine, insert): | ||
try: | ||
engine = get_engine() | ||
except: | ||
print('Could not connect to the database within spawned process') | ||
raise | ||
|
||
print("Starting parallel process") | ||
|
||
# transaction | ||
with engine.begin() as conn: | ||
conn.execute(insert) | ||
|
||
engine.dispose() | ||
|
||
return True | ||
|
||
def execute_par(self, conn_func, n_jobs=14): | ||
""" | ||
Execute all SQL statements to create final aggregation table. | ||
|
@@ -328,7 +328,8 @@ def execute_par(self, conn_func, n_jobs=14): | |
|
||
insert_list = [insert for insert in inserts[group]] | ||
|
||
out = Parallel(n_jobs=n_jobs, verbose=51)(delayed(Aggregation.execute_insert)(conn_func, insert) | ||
import pdb;pdb.set_trace() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove me There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Arrrgh |
||
out = Parallel(n_jobs=n_jobs, verbose=51)(delayed(execute_insert)(conn_func, insert) | ||
for insert in insert_list) | ||
# transaction | ||
with engine.begin() as conn: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe place this into the
sql.py
file?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the destiny for
ka/parallel
? We need to refactor things if we want to merge it intomaster
eventually anyway.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this.