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

move execute_insert to top module nesting so pickle does not err #87

Open
wants to merge 73 commits into
base: ka/parallel
Choose a base branch
from
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 Nov 17, 2016
3f35a15
syntax, when
potash Nov 17, 2016
b6cbaaa
real test
potash Nov 17, 2016
b25ab25
truediv
potash Dec 12, 2016
a5463a4
consistency fix: make sure quantites is a tuple-valued dict
potash Dec 24, 2016
837329d
Fix whitespace issues
mbauman Dec 28, 2016
f528951
Update coverage from 4.2 to 4.3.1 (#46)
pyup-bot Dec 28, 2016
aef832f
Update pytest from 3.0.4 to 3.0.5 (#44)
pyup-bot Dec 28, 2016
4584d39
Update csvkit from 0.9.1 to 1.0.0 (#43)
pyup-bot Dec 28, 2016
3a61e1c
Update csvkit from 1.0.0 to 1.0.1 (#48)
pyup-bot Dec 29, 2016
e21034a
Ep/distinct (#41)
potash Jan 3, 2017
eac71bb
Add a categorical helper function
mbauman Dec 23, 2016
51d8d2f
flake8
mbauman Dec 23, 2016
51f1134
Rename categorical to multicompare; create simple MultiCompare subclass
mbauman Dec 29, 2016
e3f52a5
support lists of tuples in quantities
mbauman Dec 29, 2016
45029e0
flake8
mbauman Dec 29, 2016
75da2fa
Rename MultiCompare to Compare; introduce Categorical
mbauman Jan 3, 2017
f7b0342
Change default include_null behavior to False
mbauman Jan 4, 2017
b812dfa
Allow passing include_null shortname as a truthy value
mbauman Jan 4, 2017
ded6fb6
Merge pull request #38 from dssg/mb/helpers
potash Jan 4, 2017
7ef0e61
Add non-dev requirements.txt (#32)
mbauman Jan 4, 2017
3389d0a
Ep/refactor spacetime (#49)
potash Jan 5, 2017
ae5c8dd
Ep/join table (#50)
potash Jan 9, 2017
4cc018e
Update to v0.2.0
thcrock Feb 26, 2017
5a6033a
get statements before exec
potash Feb 27, 2017
0ab0cb1
merge master
potash Feb 27, 2017
c843215
arithmetic
potash Feb 27, 2017
e210332
operator_str
potash Feb 27, 2017
5f9e2ac
docstring
potash Feb 27, 2017
f6ae852
make interval to accessible to spacetime aggregates
potash Feb 27, 2017
192f133
Be less lazy for Python 2.7
mbauman Feb 27, 2017
8890de1
Support format_kwargs when getting columns of AggregateExpressions
mbauman Feb 27, 2017
e29931a
Update coverage from 4.3.1 to 4.3.4 (#54)
pyup-bot Feb 28, 2017
a538a13
Update sqlalchemy to 1.1.5 (#55)
pyup-bot Feb 28, 2017
ae9458a
Update cryptography from 1.7.1 to 1.7.2 (#58)
pyup-bot Feb 28, 2017
6142a0f
Update tox from 2.5.0 to 2.6.0 (#59)
pyup-bot Feb 28, 2017
6c14f11
Update flake8 from 3.2.1 to 3.3.0 (#60)
pyup-bot Feb 28, 2017
2565473
Update sphinx from 1.5.1 to 1.5.3 (#62)
pyup-bot Feb 28, 2017
8a9325d
Add trivial integration test
mbauman Feb 28, 2017
fedd7d1
Merge branch 'master' into ep/aggregate_arithmetic
mbauman Feb 28, 2017
70c90c1
Update sqlalchemy to 1.1.6 (#64)
pyup-bot Mar 1, 2017
260696d
Update psycopg2 from 2.6.2 to 2.7 (#66)
pyup-bot Mar 1, 2017
08542f6
Update pytest from 3.0.5 to 3.0.6 (#65)
pyup-bot Mar 1, 2017
80b8b63
Go back to using the count function
mbauman Mar 1, 2017
23361d8
Update psycopg2 from 2.7 to 2.7.1 (#71)
pyup-bot Mar 14, 2017
4ae3990
Merge pull request #63 from dssg/ep/aggregate_arithmetic
mbauman Mar 14, 2017
2c60460
Update cryptography from 1.7.2 to 1.8.1 (#70)
pyup-bot Mar 14, 2017
48def77
Update pytest from 3.0.6 to 3.0.7 (#73)
pyup-bot Mar 14, 2017
b2584fe
Bundle pyupdates, please
mbauman Mar 28, 2017
e18d8af
Update sqlalchemy to 1.1.7 (#76)
pyup-bot Mar 28, 2017
fd6eb13
Scheduled biweekly dependency update for week 14 (#77)
pyup-bot Apr 3, 2017
aee37a8
use filter instead of case when
potash Apr 3, 2017
c006e22
unused format kwarg
potash Apr 3, 2017
a59ac30
add mode to tests
potash Apr 3, 2017
d841725
include order in aggregate name and test it
potash Apr 3, 2017
67f4db2
Whitespace
mbauman Apr 4, 2017
939bcde
Merge pull request #79 from dssg/ep/order_name_bug
mbauman Apr 4, 2017
c59866e
Merge pull request #78 from dssg/ep/filter
mbauman Apr 12, 2017
cab2476
Add validation and support for restricting the "beginning of time" (#74)
mbauman Apr 12, 2017
82bb17f
Update sqlalchemy from 1.1.8 to 1.1.9
pyup-bot Apr 17, 2017
f92e98b
Update sqlalchemy from 1.1.8 to 1.1.9
pyup-bot Apr 17, 2017
bc3577e
Update tox from 2.6.0 to 2.7.0
pyup-bot Apr 17, 2017
4acdeaa
Merge pull request #80 from dssg/pyup-scheduled-update-04-17-2017
mbauman Apr 17, 2017
3f9429f
Allow overriding of choice quoting [Resolves #81]
thcrock Apr 21, 2017
a1d22ce
Untangle quoting logic, rename quoting argument
thcrock Apr 21, 2017
36a93e2
Merge pull request #83 from dssg/choice_quoting
mbauman Apr 21, 2017
9682010
Don't modify dict during iteration when shortening keys
mbauman Apr 21, 2017
2d97d5a
Merge pull request #84 from dssg/mb/82
mbauman Apr 26, 2017
c5d0791
move execute_insert to top module nesting so pickle does not err
May 15, 2017
cf05dbd
remove that pdb
May 15, 2017
470ae97
move execute_insert to sql
May 15, 2017
347da7e
merge master, solve conflict
May 16, 2017
661d32c
re-add SpacetimeSubQueryAggregation
May 16, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions collate/collate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@
from .sql import make_sql_clause, to_sql_name, CreateTableAs, InsertFromSelect


def execute_insert(get_engine, insert):
Copy link
Member

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?

Copy link
Author

@kenben kenben May 15, 2017

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 into master eventually anyway.

Copy link
Author

Choose a reason for hiding this comment

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

Moved this.

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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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()
Copy link
Member

Choose a reason for hiding this comment

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

remove me

Copy link
Author

Choose a reason for hiding this comment

The 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:
Expand Down