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
DROP TABLE IF EXISTS matrices; | |
CREATE TABLE matrices ( | |
matrix_id int NOT NULL, -- unique identifier for each matrix | |
i int NOT NULL, -- row number | |
j int NOT NULL, -- column number | |
val decimal NOT NULL, -- the value in this cell | |
PRIMARY KEY (matrix_id, i, j) | |
); | |
-- insert sparse representation of |
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
import trio # async task synchronization library | |
import asks # async version of `requests` | |
from inspect import iscoroutinefunction | |
import requests | |
async def concurrent_map(inputs, task, conc_limit=1000): | |
""" | |
Like `map` except it is async. It runs an async function for each item in an iterable, and returns an array of the outputs in the correct order | |
args: | |
inputs - iterable of items which are passed to the async function |