partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
S3CopyToTable.run
If the target table doesn't exist, self.create_table will be called to attempt to create the table.
luigi/contrib/redshift.py
def run(self): """ If the target table doesn't exist, self.create_table will be called to attempt to create the table. """ if not (self.table): raise Exception("table need to be specified") path = self.s3_load_path() output = self.output() con...
def run(self): """ If the target table doesn't exist, self.create_table will be called to attempt to create the table. """ if not (self.table): raise Exception("table need to be specified") path = self.s3_load_path() output = self.output() con...
[ "If", "the", "target", "table", "doesn", "t", "exist", "self", ".", "create_table", "will", "be", "called", "to", "attempt", "to", "create", "the", "table", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L359-L384
[ "def", "run", "(", "self", ")", ":", "if", "not", "(", "self", ".", "table", ")", ":", "raise", "Exception", "(", "\"table need to be specified\"", ")", "path", "=", "self", ".", "s3_load_path", "(", ")", "output", "=", "self", ".", "output", "(", ")",...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
S3CopyToTable.copy
Defines copying from s3 into redshift. If both key-based and role-based credentials are provided, role-based will be used.
luigi/contrib/redshift.py
def copy(self, cursor, f): """ Defines copying from s3 into redshift. If both key-based and role-based credentials are provided, role-based will be used. """ logger.info("Inserting file: %s", f) colnames = '' if self.columns and len(self.columns) > 0: ...
def copy(self, cursor, f): """ Defines copying from s3 into redshift. If both key-based and role-based credentials are provided, role-based will be used. """ logger.info("Inserting file: %s", f) colnames = '' if self.columns and len(self.columns) > 0: ...
[ "Defines", "copying", "from", "s3", "into", "redshift", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L386-L408
[ "def", "copy", "(", "self", ",", "cursor", ",", "f", ")", ":", "logger", ".", "info", "(", "\"Inserting file: %s\"", ",", "f", ")", "colnames", "=", "''", "if", "self", ".", "columns", "and", "len", "(", "self", ".", "columns", ")", ">", "0", ":", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
S3CopyToTable.does_schema_exist
Determine whether the schema already exists.
luigi/contrib/redshift.py
def does_schema_exist(self, connection): """ Determine whether the schema already exists. """ if '.' in self.table: query = ("select 1 as schema_exists " "from pg_namespace " "where nspname = lower(%s) limit 1") else: ...
def does_schema_exist(self, connection): """ Determine whether the schema already exists. """ if '.' in self.table: query = ("select 1 as schema_exists " "from pg_namespace " "where nspname = lower(%s) limit 1") else: ...
[ "Determine", "whether", "the", "schema", "already", "exists", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L424-L443
[ "def", "does_schema_exist", "(", "self", ",", "connection", ")", ":", "if", "'.'", "in", "self", ".", "table", ":", "query", "=", "(", "\"select 1 as schema_exists \"", "\"from pg_namespace \"", "\"where nspname = lower(%s) limit 1\"", ")", "else", ":", "return", "T...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
S3CopyToTable.does_table_exist
Determine whether the table already exists.
luigi/contrib/redshift.py
def does_table_exist(self, connection): """ Determine whether the table already exists. """ if '.' in self.table: query = ("select 1 as table_exists " "from information_schema.tables " "where table_schema = lower(%s) and table_name =...
def does_table_exist(self, connection): """ Determine whether the table already exists. """ if '.' in self.table: query = ("select 1 as table_exists " "from information_schema.tables " "where table_schema = lower(%s) and table_name =...
[ "Determine", "whether", "the", "table", "already", "exists", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L445-L464
[ "def", "does_table_exist", "(", "self", ",", "connection", ")", ":", "if", "'.'", "in", "self", ".", "table", ":", "query", "=", "(", "\"select 1 as table_exists \"", "\"from information_schema.tables \"", "\"where table_schema = lower(%s) and table_name = lower(%s) limit 1\"...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
S3CopyToTable.init_copy
Perform pre-copy sql - such as creating table, truncating, or removing data older than x.
luigi/contrib/redshift.py
def init_copy(self, connection): """ Perform pre-copy sql - such as creating table, truncating, or removing data older than x. """ if not self.does_schema_exist(connection): logger.info("Creating schema for %s", self.table) self.create_schema(connection) ...
def init_copy(self, connection): """ Perform pre-copy sql - such as creating table, truncating, or removing data older than x. """ if not self.does_schema_exist(connection): logger.info("Creating schema for %s", self.table) self.create_schema(connection) ...
[ "Perform", "pre", "-", "copy", "sql", "-", "such", "as", "creating", "table", "truncating", "or", "removing", "data", "older", "than", "x", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L466-L487
[ "def", "init_copy", "(", "self", ",", "connection", ")", ":", "if", "not", "self", ".", "does_schema_exist", "(", "connection", ")", ":", "logger", ".", "info", "(", "\"Creating schema for %s\"", ",", "self", ".", "table", ")", "self", ".", "create_schema", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
S3CopyToTable.post_copy
Performs post-copy sql - such as cleansing data, inserting into production table (if copied to temp table), etc.
luigi/contrib/redshift.py
def post_copy(self, cursor): """ Performs post-copy sql - such as cleansing data, inserting into production table (if copied to temp table), etc. """ logger.info('Executing post copy queries') for query in self.queries: cursor.execute(query)
def post_copy(self, cursor): """ Performs post-copy sql - such as cleansing data, inserting into production table (if copied to temp table), etc. """ logger.info('Executing post copy queries') for query in self.queries: cursor.execute(query)
[ "Performs", "post", "-", "copy", "sql", "-", "such", "as", "cleansing", "data", "inserting", "into", "production", "table", "(", "if", "copied", "to", "temp", "table", ")", "etc", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L489-L495
[ "def", "post_copy", "(", "self", ",", "cursor", ")", ":", "logger", ".", "info", "(", "'Executing post copy queries'", ")", "for", "query", "in", "self", ".", "queries", ":", "cursor", ".", "execute", "(", "query", ")" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
S3CopyToTable.post_copy_metacolums
Performs post-copy to fill metadata columns.
luigi/contrib/redshift.py
def post_copy_metacolums(self, cursor): """ Performs post-copy to fill metadata columns. """ logger.info('Executing post copy metadata queries') for query in self.metadata_queries: cursor.execute(query)
def post_copy_metacolums(self, cursor): """ Performs post-copy to fill metadata columns. """ logger.info('Executing post copy metadata queries') for query in self.metadata_queries: cursor.execute(query)
[ "Performs", "post", "-", "copy", "to", "fill", "metadata", "columns", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L497-L503
[ "def", "post_copy_metacolums", "(", "self", ",", "cursor", ")", ":", "logger", ".", "info", "(", "'Executing post copy metadata queries'", ")", "for", "query", "in", "self", ".", "metadata_queries", ":", "cursor", ".", "execute", "(", "query", ")" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
S3CopyJSONToTable.copy
Defines copying JSON from s3 into redshift.
luigi/contrib/redshift.py
def copy(self, cursor, f): """ Defines copying JSON from s3 into redshift. """ logger.info("Inserting file: %s", f) cursor.execute(""" COPY %s from '%s' CREDENTIALS '%s' JSON AS '%s' %s %s ;""" % (self.table, f, self._credentials(), ...
def copy(self, cursor, f): """ Defines copying JSON from s3 into redshift. """ logger.info("Inserting file: %s", f) cursor.execute(""" COPY %s from '%s' CREDENTIALS '%s' JSON AS '%s' %s %s ;""" % (self.table, f, self._credentials(), ...
[ "Defines", "copying", "JSON", "from", "s3", "into", "redshift", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L546-L558
[ "def", "copy", "(", "self", ",", "cursor", ",", "f", ")", ":", "logger", ".", "info", "(", "\"Inserting file: %s\"", ",", "f", ")", "cursor", ".", "execute", "(", "\"\"\"\n COPY %s from '%s'\n CREDENTIALS '%s'\n JSON AS '%s' %s\n %s\n ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
KillOpenRedshiftSessions.output
Returns a RedshiftTarget representing the inserted dataset. Normally you don't override this.
luigi/contrib/redshift.py
def output(self): """ Returns a RedshiftTarget representing the inserted dataset. Normally you don't override this. """ # uses class name as a meta-table return RedshiftTarget( host=self.host, database=self.database, user=self.user, ...
def output(self): """ Returns a RedshiftTarget representing the inserted dataset. Normally you don't override this. """ # uses class name as a meta-table return RedshiftTarget( host=self.host, database=self.database, user=self.user, ...
[ "Returns", "a", "RedshiftTarget", "representing", "the", "inserted", "dataset", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L649-L662
[ "def", "output", "(", "self", ")", ":", "# uses class name as a meta-table", "return", "RedshiftTarget", "(", "host", "=", "self", ".", "host", ",", "database", "=", "self", ".", "database", ",", "user", "=", "self", ".", "user", ",", "password", "=", "sel...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
KillOpenRedshiftSessions.run
Kill any open Redshift sessions for the given database.
luigi/contrib/redshift.py
def run(self): """ Kill any open Redshift sessions for the given database. """ connection = self.output().connect() # kill any sessions other than ours and # internal Redshift sessions (rdsdb) query = ("select pg_terminate_backend(process) " "from...
def run(self): """ Kill any open Redshift sessions for the given database. """ connection = self.output().connect() # kill any sessions other than ours and # internal Redshift sessions (rdsdb) query = ("select pg_terminate_backend(process) " "from...
[ "Kill", "any", "open", "Redshift", "sessions", "for", "the", "given", "database", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L664-L701
[ "def", "run", "(", "self", ")", ":", "connection", "=", "self", ".", "output", "(", ")", ".", "connect", "(", ")", "# kill any sessions other than ours and", "# internal Redshift sessions (rdsdb)", "query", "=", "(", "\"select pg_terminate_backend(process) \"", "\"from ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
DateInterval.dates
Returns a list of dates in this date interval.
luigi/date_interval.py
def dates(self): ''' Returns a list of dates in this date interval.''' dates = [] d = self.date_a while d < self.date_b: dates.append(d) d += datetime.timedelta(1) return dates
def dates(self): ''' Returns a list of dates in this date interval.''' dates = [] d = self.date_a while d < self.date_b: dates.append(d) d += datetime.timedelta(1) return dates
[ "Returns", "a", "list", "of", "dates", "in", "this", "date", "interval", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/date_interval.py#L67-L75
[ "def", "dates", "(", "self", ")", ":", "dates", "=", "[", "]", "d", "=", "self", ".", "date_a", "while", "d", "<", "self", ".", "date_b", ":", "dates", ".", "append", "(", "d", ")", "d", "+=", "datetime", ".", "timedelta", "(", "1", ")", "retur...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
DateInterval.hours
Same as dates() but returns 24 times more info: one for each hour.
luigi/date_interval.py
def hours(self): ''' Same as dates() but returns 24 times more info: one for each hour.''' for date in self.dates(): for hour in xrange(24): yield datetime.datetime.combine(date, datetime.time(hour))
def hours(self): ''' Same as dates() but returns 24 times more info: one for each hour.''' for date in self.dates(): for hour in xrange(24): yield datetime.datetime.combine(date, datetime.time(hour))
[ "Same", "as", "dates", "()", "but", "returns", "24", "times", "more", "info", ":", "one", "for", "each", "hour", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/date_interval.py#L77-L81
[ "def", "hours", "(", "self", ")", ":", "for", "date", "in", "self", ".", "dates", "(", ")", ":", "for", "hour", "in", "xrange", "(", "24", ")", ":", "yield", "datetime", ".", "datetime", ".", "combine", "(", "date", ",", "datetime", ".", "time", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
ExperimentTask.run
The execution of this task will write 4 lines of data on this task's target output.
examples/ftp_experiment_outputs.py
def run(self): """ The execution of this task will write 4 lines of data on this task's target output. """ with self.output().open('w') as outfile: print("data 0 200 10 50 60", file=outfile) print("data 1 190 9 52 60", file=outfile) print("data 2 200 1...
def run(self): """ The execution of this task will write 4 lines of data on this task's target output. """ with self.output().open('w') as outfile: print("data 0 200 10 50 60", file=outfile) print("data 1 190 9 52 60", file=outfile) print("data 2 200 1...
[ "The", "execution", "of", "this", "task", "will", "write", "4", "lines", "of", "data", "on", "this", "task", "s", "target", "output", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/examples/ftp_experiment_outputs.py#L46-L54
[ "def", "run", "(", "self", ")", ":", "with", "self", ".", "output", "(", ")", ".", "open", "(", "'w'", ")", "as", "outfile", ":", "print", "(", "\"data 0 200 10 50 60\"", ",", "file", "=", "outfile", ")", "print", "(", "\"data 1 190 9 52 60\"", ",", "f...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
MockFileSystem.copy
Copies the contents of a single file path to dest
luigi/mock.py
def copy(self, path, dest, raise_if_exists=False): """ Copies the contents of a single file path to dest """ if raise_if_exists and dest in self.get_all_data(): raise RuntimeError('Destination exists: %s' % path) contents = self.get_all_data()[path] self.get_a...
def copy(self, path, dest, raise_if_exists=False): """ Copies the contents of a single file path to dest """ if raise_if_exists and dest in self.get_all_data(): raise RuntimeError('Destination exists: %s' % path) contents = self.get_all_data()[path] self.get_a...
[ "Copies", "the", "contents", "of", "a", "single", "file", "path", "to", "dest" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/mock.py#L40-L47
[ "def", "copy", "(", "self", ",", "path", ",", "dest", ",", "raise_if_exists", "=", "False", ")", ":", "if", "raise_if_exists", "and", "dest", "in", "self", ".", "get_all_data", "(", ")", ":", "raise", "RuntimeError", "(", "'Destination exists: %s'", "%", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
MockFileSystem.remove
Removes the given mockfile. skip_trash doesn't have any meaning.
luigi/mock.py
def remove(self, path, recursive=True, skip_trash=True): """ Removes the given mockfile. skip_trash doesn't have any meaning. """ if recursive: to_delete = [] for s in self.get_all_data().keys(): if s.startswith(path): to_delete...
def remove(self, path, recursive=True, skip_trash=True): """ Removes the given mockfile. skip_trash doesn't have any meaning. """ if recursive: to_delete = [] for s in self.get_all_data().keys(): if s.startswith(path): to_delete...
[ "Removes", "the", "given", "mockfile", ".", "skip_trash", "doesn", "t", "have", "any", "meaning", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/mock.py#L61-L73
[ "def", "remove", "(", "self", ",", "path", ",", "recursive", "=", "True", ",", "skip_trash", "=", "True", ")", ":", "if", "recursive", ":", "to_delete", "=", "[", "]", "for", "s", "in", "self", ".", "get_all_data", "(", ")", ".", "keys", "(", ")", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
MockFileSystem.move
Moves a single file from path to dest
luigi/mock.py
def move(self, path, dest, raise_if_exists=False): """ Moves a single file from path to dest """ if raise_if_exists and dest in self.get_all_data(): raise RuntimeError('Destination exists: %s' % path) contents = self.get_all_data().pop(path) self.get_all_data(...
def move(self, path, dest, raise_if_exists=False): """ Moves a single file from path to dest """ if raise_if_exists and dest in self.get_all_data(): raise RuntimeError('Destination exists: %s' % path) contents = self.get_all_data().pop(path) self.get_all_data(...
[ "Moves", "a", "single", "file", "from", "path", "to", "dest" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/mock.py#L75-L82
[ "def", "move", "(", "self", ",", "path", ",", "dest", ",", "raise_if_exists", "=", "False", ")", ":", "if", "raise_if_exists", "and", "dest", "in", "self", ".", "get_all_data", "(", ")", ":", "raise", "RuntimeError", "(", "'Destination exists: %s'", "%", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
MockFileSystem.listdir
listdir does a prefix match of self.get_all_data(), but doesn't yet support globs.
luigi/mock.py
def listdir(self, path): """ listdir does a prefix match of self.get_all_data(), but doesn't yet support globs. """ return [s for s in self.get_all_data().keys() if s.startswith(path)]
def listdir(self, path): """ listdir does a prefix match of self.get_all_data(), but doesn't yet support globs. """ return [s for s in self.get_all_data().keys() if s.startswith(path)]
[ "listdir", "does", "a", "prefix", "match", "of", "self", ".", "get_all_data", "()", "but", "doesn", "t", "yet", "support", "globs", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/mock.py#L84-L89
[ "def", "listdir", "(", "self", ",", "path", ")", ":", "return", "[", "s", "for", "s", "in", "self", ".", "get_all_data", "(", ")", ".", "keys", "(", ")", "if", "s", ".", "startswith", "(", "path", ")", "]" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
MockTarget.move
Call MockFileSystem's move command
luigi/mock.py
def move(self, path, raise_if_exists=False): """ Call MockFileSystem's move command """ self.fs.move(self.path, path, raise_if_exists)
def move(self, path, raise_if_exists=False): """ Call MockFileSystem's move command """ self.fs.move(self.path, path, raise_if_exists)
[ "Call", "MockFileSystem", "s", "move", "command" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/mock.py#L122-L126
[ "def", "move", "(", "self", ",", "path", ",", "raise_if_exists", "=", "False", ")", ":", "self", ".", "fs", ".", "move", "(", "self", ".", "path", ",", "path", ",", "raise_if_exists", ")" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
_recursively_freeze
Recursively walks ``Mapping``s and ``list``s and converts them to ``_FrozenOrderedDict`` and ``tuples``, respectively.
luigi/parameter.py
def _recursively_freeze(value): """ Recursively walks ``Mapping``s and ``list``s and converts them to ``_FrozenOrderedDict`` and ``tuples``, respectively. """ if isinstance(value, Mapping): return _FrozenOrderedDict(((k, _recursively_freeze(v)) for k, v in value.items())) elif isinstance(val...
def _recursively_freeze(value): """ Recursively walks ``Mapping``s and ``list``s and converts them to ``_FrozenOrderedDict`` and ``tuples``, respectively. """ if isinstance(value, Mapping): return _FrozenOrderedDict(((k, _recursively_freeze(v)) for k, v in value.items())) elif isinstance(val...
[ "Recursively", "walks", "Mapping", "s", "and", "list", "s", "and", "converts", "them", "to", "_FrozenOrderedDict", "and", "tuples", "respectively", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L929-L937
[ "def", "_recursively_freeze", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "Mapping", ")", ":", "return", "_FrozenOrderedDict", "(", "(", "(", "k", ",", "_recursively_freeze", "(", "v", ")", ")", "for", "k", ",", "v", "in", "value", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
Parameter._get_value_from_config
Loads the default from the config. Returns _no_value if it doesn't exist
luigi/parameter.py
def _get_value_from_config(self, section, name): """Loads the default from the config. Returns _no_value if it doesn't exist""" conf = configuration.get_config() try: value = conf.get(section, name) except (NoSectionError, NoOptionError, KeyError): return _no_va...
def _get_value_from_config(self, section, name): """Loads the default from the config. Returns _no_value if it doesn't exist""" conf = configuration.get_config() try: value = conf.get(section, name) except (NoSectionError, NoOptionError, KeyError): return _no_va...
[ "Loads", "the", "default", "from", "the", "config", ".", "Returns", "_no_value", "if", "it", "doesn", "t", "exist" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L192-L202
[ "def", "_get_value_from_config", "(", "self", ",", "section", ",", "name", ")", ":", "conf", "=", "configuration", ".", "get_config", "(", ")", "try", ":", "value", "=", "conf", ".", "get", "(", "section", ",", "name", ")", "except", "(", "NoSectionError...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
Parameter._value_iterator
Yield the parameter values, with optional deprecation warning as second tuple value. The parameter value will be whatever non-_no_value that is yielded first.
luigi/parameter.py
def _value_iterator(self, task_name, param_name): """ Yield the parameter values, with optional deprecation warning as second tuple value. The parameter value will be whatever non-_no_value that is yielded first. """ cp_parser = CmdlineParser.get_instance() if cp_parser:...
def _value_iterator(self, task_name, param_name): """ Yield the parameter values, with optional deprecation warning as second tuple value. The parameter value will be whatever non-_no_value that is yielded first. """ cp_parser = CmdlineParser.get_instance() if cp_parser:...
[ "Yield", "the", "parameter", "values", "with", "optional", "deprecation", "warning", "as", "second", "tuple", "value", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L212-L228
[ "def", "_value_iterator", "(", "self", ",", "task_name", ",", "param_name", ")", ":", "cp_parser", "=", "CmdlineParser", ".", "get_instance", "(", ")", "if", "cp_parser", ":", "dest", "=", "self", ".", "_parser_global_dest", "(", "param_name", ",", "task_name"...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
Parameter._parse_list
Parse a list of values from the scheduler. Only possible if this is_batchable() is True. This will combine the list into a single parameter value using batch method. This should never need to be overridden. :param xs: list of values to parse and combine :return: the combined parsed val...
luigi/parameter.py
def _parse_list(self, xs): """ Parse a list of values from the scheduler. Only possible if this is_batchable() is True. This will combine the list into a single parameter value using batch method. This should never need to be overridden. :param xs: list of values to parse and c...
def _parse_list(self, xs): """ Parse a list of values from the scheduler. Only possible if this is_batchable() is True. This will combine the list into a single parameter value using batch method. This should never need to be overridden. :param xs: list of values to parse and c...
[ "Parse", "a", "list", "of", "values", "from", "the", "scheduler", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L255-L270
[ "def", "_parse_list", "(", "self", ",", "xs", ")", ":", "if", "not", "self", ".", "_is_batchable", "(", ")", ":", "raise", "NotImplementedError", "(", "'No batch method found'", ")", "elif", "not", "xs", ":", "raise", "ValueError", "(", "'Empty parameter list ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
_DateParameterBase.parse
Parses a date string formatted like ``YYYY-MM-DD``.
luigi/parameter.py
def parse(self, s): """ Parses a date string formatted like ``YYYY-MM-DD``. """ return datetime.datetime.strptime(s, self.date_format).date()
def parse(self, s): """ Parses a date string formatted like ``YYYY-MM-DD``. """ return datetime.datetime.strptime(s, self.date_format).date()
[ "Parses", "a", "date", "string", "formatted", "like", "YYYY", "-", "MM", "-", "DD", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L373-L377
[ "def", "parse", "(", "self", ",", "s", ")", ":", "return", "datetime", ".", "datetime", ".", "strptime", "(", "s", ",", "self", ".", "date_format", ")", ".", "date", "(", ")" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
_DateParameterBase.serialize
Converts the date to a string using the :py:attr:`~_DateParameterBase.date_format`.
luigi/parameter.py
def serialize(self, dt): """ Converts the date to a string using the :py:attr:`~_DateParameterBase.date_format`. """ if dt is None: return str(dt) return dt.strftime(self.date_format)
def serialize(self, dt): """ Converts the date to a string using the :py:attr:`~_DateParameterBase.date_format`. """ if dt is None: return str(dt) return dt.strftime(self.date_format)
[ "Converts", "the", "date", "to", "a", "string", "using", "the", ":", "py", ":", "attr", ":", "~_DateParameterBase", ".", "date_format", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L379-L385
[ "def", "serialize", "(", "self", ",", "dt", ")", ":", "if", "dt", "is", "None", ":", "return", "str", "(", "dt", ")", "return", "dt", ".", "strftime", "(", "self", ".", "date_format", ")" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
MonthParameter._add_months
Add ``months`` months to ``date``. Unfortunately we can't use timedeltas to add months because timedelta counts in days and there's no foolproof way to add N months in days without counting the number of days per month.
luigi/parameter.py
def _add_months(self, date, months): """ Add ``months`` months to ``date``. Unfortunately we can't use timedeltas to add months because timedelta counts in days and there's no foolproof way to add N months in days without counting the number of days per month. """ ...
def _add_months(self, date, months): """ Add ``months`` months to ``date``. Unfortunately we can't use timedeltas to add months because timedelta counts in days and there's no foolproof way to add N months in days without counting the number of days per month. """ ...
[ "Add", "months", "months", "to", "date", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L447-L457
[ "def", "_add_months", "(", "self", ",", "date", ",", "months", ")", ":", "year", "=", "date", ".", "year", "+", "(", "date", ".", "month", "+", "months", "-", "1", ")", "//", "12", "month", "=", "(", "date", ".", "month", "+", "months", "-", "1...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
_DatetimeParameterBase.normalize
Clamp dt to every Nth :py:attr:`~_DatetimeParameterBase.interval` starting at :py:attr:`~_DatetimeParameterBase.start`.
luigi/parameter.py
def normalize(self, dt): """ Clamp dt to every Nth :py:attr:`~_DatetimeParameterBase.interval` starting at :py:attr:`~_DatetimeParameterBase.start`. """ if dt is None: return None dt = self._convert_to_dt(dt) dt = dt.replace(microsecond=0) # remove ...
def normalize(self, dt): """ Clamp dt to every Nth :py:attr:`~_DatetimeParameterBase.interval` starting at :py:attr:`~_DatetimeParameterBase.start`. """ if dt is None: return None dt = self._convert_to_dt(dt) dt = dt.replace(microsecond=0) # remove ...
[ "Clamp", "dt", "to", "every", "Nth", ":", "py", ":", "attr", ":", "~_DatetimeParameterBase", ".", "interval", "starting", "at", ":", "py", ":", "attr", ":", "~_DatetimeParameterBase", ".", "start", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L544-L557
[ "def", "normalize", "(", "self", ",", "dt", ")", ":", "if", "dt", "is", "None", ":", "return", "None", "dt", "=", "self", ".", "_convert_to_dt", "(", "dt", ")", "dt", "=", "dt", ".", "replace", "(", "microsecond", "=", "0", ")", "# remove microsecond...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
BoolParameter.parse
Parses a ``bool`` from the string, matching 'true' or 'false' ignoring case.
luigi/parameter.py
def parse(self, val): """ Parses a ``bool`` from the string, matching 'true' or 'false' ignoring case. """ s = str(val).lower() if s == "true": return True elif s == "false": return False else: raise ValueError("cannot interpret...
def parse(self, val): """ Parses a ``bool`` from the string, matching 'true' or 'false' ignoring case. """ s = str(val).lower() if s == "true": return True elif s == "false": return False else: raise ValueError("cannot interpret...
[ "Parses", "a", "bool", "from", "the", "string", "matching", "true", "or", "false", "ignoring", "case", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L686-L696
[ "def", "parse", "(", "self", ",", "val", ")", ":", "s", "=", "str", "(", "val", ")", ".", "lower", "(", ")", "if", "s", "==", "\"true\"", ":", "return", "True", "elif", "s", "==", "\"false\"", ":", "return", "False", "else", ":", "raise", "ValueE...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
DateIntervalParameter.parse
Parses a :py:class:`~luigi.date_interval.DateInterval` from the input. see :py:mod:`luigi.date_interval` for details on the parsing of DateIntervals.
luigi/parameter.py
def parse(self, s): """ Parses a :py:class:`~luigi.date_interval.DateInterval` from the input. see :py:mod:`luigi.date_interval` for details on the parsing of DateIntervals. """ # TODO: can we use xml.utils.iso8601 or something similar? from luigi import date_...
def parse(self, s): """ Parses a :py:class:`~luigi.date_interval.DateInterval` from the input. see :py:mod:`luigi.date_interval` for details on the parsing of DateIntervals. """ # TODO: can we use xml.utils.iso8601 or something similar? from luigi import date_...
[ "Parses", "a", ":", "py", ":", "class", ":", "~luigi", ".", "date_interval", ".", "DateInterval", "from", "the", "input", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L726-L742
[ "def", "parse", "(", "self", ",", "s", ")", ":", "# TODO: can we use xml.utils.iso8601 or something similar?", "from", "luigi", "import", "date_interval", "as", "d", "for", "cls", "in", "[", "d", ".", "Year", ",", "d", ".", "Month", ",", "d", ".", "Week", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
TimeDeltaParameter.parse
Parses a time delta from the input. See :py:class:`TimeDeltaParameter` for details on supported formats.
luigi/parameter.py
def parse(self, input): """ Parses a time delta from the input. See :py:class:`TimeDeltaParameter` for details on supported formats. """ result = self._parseIso8601(input) if not result: result = self._parseSimple(input) if result is not None: ...
def parse(self, input): """ Parses a time delta from the input. See :py:class:`TimeDeltaParameter` for details on supported formats. """ result = self._parseIso8601(input) if not result: result = self._parseSimple(input) if result is not None: ...
[ "Parses", "a", "time", "delta", "from", "the", "input", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L790-L802
[ "def", "parse", "(", "self", ",", "input", ")", ":", "result", "=", "self", ".", "_parseIso8601", "(", "input", ")", "if", "not", "result", ":", "result", "=", "self", ".", "_parseSimple", "(", "input", ")", "if", "result", "is", "not", "None", ":", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
TimeDeltaParameter.serialize
Converts datetime.timedelta to a string :param x: the value to serialize.
luigi/parameter.py
def serialize(self, x): """ Converts datetime.timedelta to a string :param x: the value to serialize. """ weeks = x.days // 7 days = x.days % 7 hours = x.seconds // 3600 minutes = (x.seconds % 3600) // 60 seconds = (x.seconds % 3600) % 60 ...
def serialize(self, x): """ Converts datetime.timedelta to a string :param x: the value to serialize. """ weeks = x.days // 7 days = x.days % 7 hours = x.seconds // 3600 minutes = (x.seconds % 3600) // 60 seconds = (x.seconds % 3600) % 60 ...
[ "Converts", "datetime", ".", "timedelta", "to", "a", "string" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L804-L816
[ "def", "serialize", "(", "self", ",", "x", ")", ":", "weeks", "=", "x", ".", "days", "//", "7", "days", "=", "x", ".", "days", "%", "7", "hours", "=", "x", ".", "seconds", "//", "3600", "minutes", "=", "(", "x", ".", "seconds", "%", "3600", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
TupleParameter.parse
Parse an individual value from the input. :param str x: the value to parse. :return: the parsed value.
luigi/parameter.py
def parse(self, x): """ Parse an individual value from the input. :param str x: the value to parse. :return: the parsed value. """ # Since the result of json.dumps(tuple) differs from a tuple string, we must handle either case. # A tuple string may come from a co...
def parse(self, x): """ Parse an individual value from the input. :param str x: the value to parse. :return: the parsed value. """ # Since the result of json.dumps(tuple) differs from a tuple string, we must handle either case. # A tuple string may come from a co...
[ "Parse", "an", "individual", "value", "from", "the", "input", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L1096-L1119
[ "def", "parse", "(", "self", ",", "x", ")", ":", "# Since the result of json.dumps(tuple) differs from a tuple string, we must handle either case.", "# A tuple string may come from a config file or from cli execution.", "# t = ((1, 2), (3, 4))", "# t_str = '((1,2),(3,4))'", "# t_json_str = j...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
WordCount.run
1. count the words for each of the :py:meth:`~.InputText.output` targets created by :py:class:`~.InputText` 2. write the count into the :py:meth:`~.WordCount.output` target
examples/wordcount.py
def run(self): """ 1. count the words for each of the :py:meth:`~.InputText.output` targets created by :py:class:`~.InputText` 2. write the count into the :py:meth:`~.WordCount.output` target """ count = {} # NOTE: self.input() actually returns an element for the InputTe...
def run(self): """ 1. count the words for each of the :py:meth:`~.InputText.output` targets created by :py:class:`~.InputText` 2. write the count into the :py:meth:`~.WordCount.output` target """ count = {} # NOTE: self.input() actually returns an element for the InputTe...
[ "1", ".", "count", "the", "words", "for", "each", "of", "the", ":", "py", ":", "meth", ":", "~", ".", "InputText", ".", "output", "targets", "created", "by", ":", "py", ":", "class", ":", "~", ".", "InputText", "2", ".", "write", "the", "count", ...
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/examples/wordcount.py#L63-L80
[ "def", "run", "(", "self", ")", ":", "count", "=", "{", "}", "# NOTE: self.input() actually returns an element for the InputText.output() target", "for", "f", "in", "self", ".", "input", "(", ")", ":", "# The input() method is a wrapper around requires() that returns Target o...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
create_packages_archive
Create a tar archive which will contain the files for the packages listed in packages.
luigi/contrib/hadoop.py
def create_packages_archive(packages, filename): """ Create a tar archive which will contain the files for the packages listed in packages. """ import tarfile tar = tarfile.open(filename, "w") def add(src, dst): logger.debug('adding to tar: %s -> %s', src, dst) tar.add(src, dst)...
def create_packages_archive(packages, filename): """ Create a tar archive which will contain the files for the packages listed in packages. """ import tarfile tar = tarfile.open(filename, "w") def add(src, dst): logger.debug('adding to tar: %s -> %s', src, dst) tar.add(src, dst)...
[ "Create", "a", "tar", "archive", "which", "will", "contain", "the", "files", "for", "the", "packages", "listed", "in", "packages", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L124-L194
[ "def", "create_packages_archive", "(", "packages", ",", "filename", ")", ":", "import", "tarfile", "tar", "=", "tarfile", ".", "open", "(", "filename", ",", "\"w\"", ")", "def", "add", "(", "src", ",", "dst", ")", ":", "logger", ".", "debug", "(", "'ad...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
flatten
A simple generator which flattens a sequence. Only one level is flattened. .. code-block:: python (1, (2, 3), 4) -> (1, 2, 3, 4)
luigi/contrib/hadoop.py
def flatten(sequence): """ A simple generator which flattens a sequence. Only one level is flattened. .. code-block:: python (1, (2, 3), 4) -> (1, 2, 3, 4) """ for item in sequence: if hasattr(item, "__iter__") and not isinstance(item, str) and not isinstance(item, bytes): ...
def flatten(sequence): """ A simple generator which flattens a sequence. Only one level is flattened. .. code-block:: python (1, (2, 3), 4) -> (1, 2, 3, 4) """ for item in sequence: if hasattr(item, "__iter__") and not isinstance(item, str) and not isinstance(item, bytes): ...
[ "A", "simple", "generator", "which", "flattens", "a", "sequence", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L197-L213
[ "def", "flatten", "(", "sequence", ")", ":", "for", "item", "in", "sequence", ":", "if", "hasattr", "(", "item", ",", "\"__iter__\"", ")", "and", "not", "isinstance", "(", "item", ",", "str", ")", "and", "not", "isinstance", "(", "item", ",", "bytes", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
run_and_track_hadoop_job
Runs the job by invoking the command from the given arglist. Finds tracking urls from the output and attempts to fetch errors using those urls if the job fails. Throws HadoopJobError with information about the error (including stdout and stderr from the process) on failure and returns normally otherwise...
luigi/contrib/hadoop.py
def run_and_track_hadoop_job(arglist, tracking_url_callback=None, env=None): """ Runs the job by invoking the command from the given arglist. Finds tracking urls from the output and attempts to fetch errors using those urls if the job fails. Throws HadoopJobError with information about the error (in...
def run_and_track_hadoop_job(arglist, tracking_url_callback=None, env=None): """ Runs the job by invoking the command from the given arglist. Finds tracking urls from the output and attempts to fetch errors using those urls if the job fails. Throws HadoopJobError with information about the error (in...
[ "Runs", "the", "job", "by", "invoking", "the", "command", "from", "the", "given", "arglist", ".", "Finds", "tracking", "urls", "from", "the", "output", "and", "attempts", "to", "fetch", "errors", "using", "those", "urls", "if", "the", "job", "fails", ".", ...
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L256-L353
[ "def", "run_and_track_hadoop_job", "(", "arglist", ",", "tracking_url_callback", "=", "None", ",", "env", "=", "None", ")", ":", "logger", ".", "info", "(", "'%s'", ",", "subprocess", ".", "list2cmdline", "(", "arglist", ")", ")", "def", "write_luigi_history",...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
fetch_task_failures
Uses mechanize to fetch the actual task logs from the task tracker. This is highly opportunistic, and we might not succeed. So we set a low timeout and hope it works. If it does not, it's not the end of the world. TODO: Yarn has a REST API that we should probably use instead: http://hadoop.apache....
luigi/contrib/hadoop.py
def fetch_task_failures(tracking_url): """ Uses mechanize to fetch the actual task logs from the task tracker. This is highly opportunistic, and we might not succeed. So we set a low timeout and hope it works. If it does not, it's not the end of the world. TODO: Yarn has a REST API that we sho...
def fetch_task_failures(tracking_url): """ Uses mechanize to fetch the actual task logs from the task tracker. This is highly opportunistic, and we might not succeed. So we set a low timeout and hope it works. If it does not, it's not the end of the world. TODO: Yarn has a REST API that we sho...
[ "Uses", "mechanize", "to", "fetch", "the", "actual", "task", "logs", "from", "the", "task", "tracker", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L356-L391
[ "def", "fetch_task_failures", "(", "tracking_url", ")", ":", "import", "mechanize", "timeout", "=", "3.0", "failures_url", "=", "tracking_url", ".", "replace", "(", "'jobdetails.jsp'", ",", "'jobfailures.jsp'", ")", "+", "'&cause=failed'", "logger", ".", "debug", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
BaseHadoopJobTask._get_pool
Protected method
luigi/contrib/hadoop.py
def _get_pool(self): """ Protected method """ if self.pool: return self.pool if hadoop().pool: return hadoop().pool
def _get_pool(self): """ Protected method """ if self.pool: return self.pool if hadoop().pool: return hadoop().pool
[ "Protected", "method" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L688-L693
[ "def", "_get_pool", "(", "self", ")", ":", "if", "self", ".", "pool", ":", "return", "self", ".", "pool", "if", "hadoop", "(", ")", ".", "pool", ":", "return", "hadoop", "(", ")", ".", "pool" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
JobTask.job_runner
Get the MapReduce runner for this job. If all outputs are HdfsTargets, the DefaultHadoopJobRunner will be used. Otherwise, the LocalJobRunner which streams all data through the local machine will be used (great for testing).
luigi/contrib/hadoop.py
def job_runner(self): # We recommend that you define a subclass, override this method and set up your own config """ Get the MapReduce runner for this job. If all outputs are HdfsTargets, the DefaultHadoopJobRunner will be used. Otherwise, the LocalJobRunner which streams all da...
def job_runner(self): # We recommend that you define a subclass, override this method and set up your own config """ Get the MapReduce runner for this job. If all outputs are HdfsTargets, the DefaultHadoopJobRunner will be used. Otherwise, the LocalJobRunner which streams all da...
[ "Get", "the", "MapReduce", "runner", "for", "this", "job", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L813-L829
[ "def", "job_runner", "(", "self", ")", ":", "# We recommend that you define a subclass, override this method and set up your own config", "outputs", "=", "luigi", ".", "task", ".", "flatten", "(", "self", ".", "output", "(", ")", ")", "for", "output", "in", "outputs",...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
JobTask.writer
Writer format is a method which iterates over the output records from the reducer and formats them for output. The default implementation outputs tab separated items.
luigi/contrib/hadoop.py
def writer(self, outputs, stdout, stderr=sys.stderr): """ Writer format is a method which iterates over the output records from the reducer and formats them for output. The default implementation outputs tab separated items. """ for output in outputs: try: ...
def writer(self, outputs, stdout, stderr=sys.stderr): """ Writer format is a method which iterates over the output records from the reducer and formats them for output. The default implementation outputs tab separated items. """ for output in outputs: try: ...
[ "Writer", "format", "is", "a", "method", "which", "iterates", "over", "the", "output", "records", "from", "the", "reducer", "and", "formats", "them", "for", "output", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L839-L858
[ "def", "writer", "(", "self", ",", "outputs", ",", "stdout", ",", "stderr", "=", "sys", ".", "stderr", ")", ":", "for", "output", "in", "outputs", ":", "try", ":", "output", "=", "flatten", "(", "output", ")", "if", "self", ".", "data_interchange_forma...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
JobTask.incr_counter
Increments a Hadoop counter. Since counters can be a bit slow to update, this batches the updates.
luigi/contrib/hadoop.py
def incr_counter(self, *args, **kwargs): """ Increments a Hadoop counter. Since counters can be a bit slow to update, this batches the updates. """ threshold = kwargs.get("threshold", self.batch_counter_default) if len(args) == 2: # backwards compatibility wi...
def incr_counter(self, *args, **kwargs): """ Increments a Hadoop counter. Since counters can be a bit slow to update, this batches the updates. """ threshold = kwargs.get("threshold", self.batch_counter_default) if len(args) == 2: # backwards compatibility wi...
[ "Increments", "a", "Hadoop", "counter", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L870-L891
[ "def", "incr_counter", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "threshold", "=", "kwargs", ".", "get", "(", "\"threshold\"", ",", "self", ".", "batch_counter_default", ")", "if", "len", "(", "args", ")", "==", "2", ":", "# b...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
JobTask._flush_batch_incr_counter
Increments any unflushed counter values.
luigi/contrib/hadoop.py
def _flush_batch_incr_counter(self): """ Increments any unflushed counter values. """ for key, count in six.iteritems(self._counter_dict): if count == 0: continue args = list(key) + [count] self._incr_counter(*args) self._co...
def _flush_batch_incr_counter(self): """ Increments any unflushed counter values. """ for key, count in six.iteritems(self._counter_dict): if count == 0: continue args = list(key) + [count] self._incr_counter(*args) self._co...
[ "Increments", "any", "unflushed", "counter", "values", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L893-L902
[ "def", "_flush_batch_incr_counter", "(", "self", ")", ":", "for", "key", ",", "count", "in", "six", ".", "iteritems", "(", "self", ".", "_counter_dict", ")", ":", "if", "count", "==", "0", ":", "continue", "args", "=", "list", "(", "key", ")", "+", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
JobTask._incr_counter
Increments a Hadoop counter. Note that this seems to be a bit slow, ~1 ms Don't overuse this function by updating very frequently.
luigi/contrib/hadoop.py
def _incr_counter(self, *args): """ Increments a Hadoop counter. Note that this seems to be a bit slow, ~1 ms Don't overuse this function by updating very frequently. """ if len(args) == 2: # backwards compatibility with existing hadoop jobs grou...
def _incr_counter(self, *args): """ Increments a Hadoop counter. Note that this seems to be a bit slow, ~1 ms Don't overuse this function by updating very frequently. """ if len(args) == 2: # backwards compatibility with existing hadoop jobs grou...
[ "Increments", "a", "Hadoop", "counter", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L904-L918
[ "def", "_incr_counter", "(", "self", ",", "*", "args", ")", ":", "if", "len", "(", "args", ")", "==", "2", ":", "# backwards compatibility with existing hadoop jobs", "group_name", ",", "count", "=", "args", "print", "(", "'reporter:counter:%s,%s'", "%", "(", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
JobTask.dump
Dump instance to file.
luigi/contrib/hadoop.py
def dump(self, directory=''): """ Dump instance to file. """ with self.no_unpicklable_properties(): file_name = os.path.join(directory, 'job-instance.pickle') if self.__module__ == '__main__': d = pickle.dumps(self) module_name = os...
def dump(self, directory=''): """ Dump instance to file. """ with self.no_unpicklable_properties(): file_name = os.path.join(directory, 'job-instance.pickle') if self.__module__ == '__main__': d = pickle.dumps(self) module_name = os...
[ "Dump", "instance", "to", "file", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L974-L987
[ "def", "dump", "(", "self", ",", "directory", "=", "''", ")", ":", "with", "self", ".", "no_unpicklable_properties", "(", ")", ":", "file_name", "=", "os", ".", "path", ".", "join", "(", "directory", ",", "'job-instance.pickle'", ")", "if", "self", ".", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
JobTask._map_input
Iterate over input and call the mapper for each item. If the job has a parser defined, the return values from the parser will be passed as arguments to the mapper. If the input is coded output from a previous run, the arguments will be splitted in key and value.
luigi/contrib/hadoop.py
def _map_input(self, input_stream): """ Iterate over input and call the mapper for each item. If the job has a parser defined, the return values from the parser will be passed as arguments to the mapper. If the input is coded output from a previous run, the arguments wil...
def _map_input(self, input_stream): """ Iterate over input and call the mapper for each item. If the job has a parser defined, the return values from the parser will be passed as arguments to the mapper. If the input is coded output from a previous run, the arguments wil...
[ "Iterate", "over", "input", "and", "call", "the", "mapper", "for", "each", "item", ".", "If", "the", "job", "has", "a", "parser", "defined", "the", "return", "values", "from", "the", "parser", "will", "be", "passed", "as", "arguments", "to", "the", "mapp...
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L989-L1004
[ "def", "_map_input", "(", "self", ",", "input_stream", ")", ":", "for", "record", "in", "self", ".", "reader", "(", "input_stream", ")", ":", "for", "output", "in", "self", ".", "mapper", "(", "*", "record", ")", ":", "yield", "output", "if", "self", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
JobTask._reduce_input
Iterate over input, collect values with the same key, and call the reducer for each unique key.
luigi/contrib/hadoop.py
def _reduce_input(self, inputs, reducer, final=NotImplemented): """ Iterate over input, collect values with the same key, and call the reducer for each unique key. """ for key, values in groupby(inputs, key=lambda x: self.internal_serialize(x[0])): for output in reducer(self....
def _reduce_input(self, inputs, reducer, final=NotImplemented): """ Iterate over input, collect values with the same key, and call the reducer for each unique key. """ for key, values in groupby(inputs, key=lambda x: self.internal_serialize(x[0])): for output in reducer(self....
[ "Iterate", "over", "input", "collect", "values", "with", "the", "same", "key", "and", "call", "the", "reducer", "for", "each", "unique", "key", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1006-L1016
[ "def", "_reduce_input", "(", "self", ",", "inputs", ",", "reducer", ",", "final", "=", "NotImplemented", ")", ":", "for", "key", ",", "values", "in", "groupby", "(", "inputs", ",", "key", "=", "lambda", "x", ":", "self", ".", "internal_serialize", "(", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
JobTask.run_mapper
Run the mapper on the hadoop node.
luigi/contrib/hadoop.py
def run_mapper(self, stdin=sys.stdin, stdout=sys.stdout): """ Run the mapper on the hadoop node. """ self.init_hadoop() self.init_mapper() outputs = self._map_input((line[:-1] for line in stdin)) if self.reducer == NotImplemented: self.writer(outputs, ...
def run_mapper(self, stdin=sys.stdin, stdout=sys.stdout): """ Run the mapper on the hadoop node. """ self.init_hadoop() self.init_mapper() outputs = self._map_input((line[:-1] for line in stdin)) if self.reducer == NotImplemented: self.writer(outputs, ...
[ "Run", "the", "mapper", "on", "the", "hadoop", "node", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1018-L1028
[ "def", "run_mapper", "(", "self", ",", "stdin", "=", "sys", ".", "stdin", ",", "stdout", "=", "sys", ".", "stdout", ")", ":", "self", ".", "init_hadoop", "(", ")", "self", ".", "init_mapper", "(", ")", "outputs", "=", "self", ".", "_map_input", "(", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
JobTask.run_reducer
Run the reducer on the hadoop node.
luigi/contrib/hadoop.py
def run_reducer(self, stdin=sys.stdin, stdout=sys.stdout): """ Run the reducer on the hadoop node. """ self.init_hadoop() self.init_reducer() outputs = self._reduce_input(self.internal_reader((line[:-1] for line in stdin)), self.reducer, self.final_reducer) self.w...
def run_reducer(self, stdin=sys.stdin, stdout=sys.stdout): """ Run the reducer on the hadoop node. """ self.init_hadoop() self.init_reducer() outputs = self._reduce_input(self.internal_reader((line[:-1] for line in stdin)), self.reducer, self.final_reducer) self.w...
[ "Run", "the", "reducer", "on", "the", "hadoop", "node", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1030-L1037
[ "def", "run_reducer", "(", "self", ",", "stdin", "=", "sys", ".", "stdin", ",", "stdout", "=", "sys", ".", "stdout", ")", ":", "self", ".", "init_hadoop", "(", ")", "self", ".", "init_reducer", "(", ")", "outputs", "=", "self", ".", "_reduce_input", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
JobTask.internal_reader
Reader which uses python eval on each part of a tab separated string. Yields a tuple of python objects.
luigi/contrib/hadoop.py
def internal_reader(self, input_stream): """ Reader which uses python eval on each part of a tab separated string. Yields a tuple of python objects. """ for input_line in input_stream: yield list(map(self.deserialize, input_line.split("\t")))
def internal_reader(self, input_stream): """ Reader which uses python eval on each part of a tab separated string. Yields a tuple of python objects. """ for input_line in input_stream: yield list(map(self.deserialize, input_line.split("\t")))
[ "Reader", "which", "uses", "python", "eval", "on", "each", "part", "of", "a", "tab", "separated", "string", ".", "Yields", "a", "tuple", "of", "python", "objects", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1045-L1051
[ "def", "internal_reader", "(", "self", ",", "input_stream", ")", ":", "for", "input_line", "in", "input_stream", ":", "yield", "list", "(", "map", "(", "self", ".", "deserialize", ",", "input_line", ".", "split", "(", "\"\\t\"", ")", ")", ")" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
JobTask.internal_writer
Writer which outputs the python repr for each item.
luigi/contrib/hadoop.py
def internal_writer(self, outputs, stdout): """ Writer which outputs the python repr for each item. """ for output in outputs: print("\t".join(map(self.internal_serialize, output)), file=stdout)
def internal_writer(self, outputs, stdout): """ Writer which outputs the python repr for each item. """ for output in outputs: print("\t".join(map(self.internal_serialize, output)), file=stdout)
[ "Writer", "which", "outputs", "the", "python", "repr", "for", "each", "item", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1053-L1058
[ "def", "internal_writer", "(", "self", ",", "outputs", ",", "stdout", ")", ":", "for", "output", "in", "outputs", ":", "print", "(", "\"\\t\"", ".", "join", "(", "map", "(", "self", ".", "internal_serialize", ",", "output", ")", ")", ",", "file", "=", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
PostgresTarget.touch
Mark this update as complete. Important: If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created.
luigi/contrib/postgres.py
def touch(self, connection=None): """ Mark this update as complete. Important: If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created. """ self.create_marker_table() i...
def touch(self, connection=None): """ Mark this update as complete. Important: If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created. """ self.create_marker_table() i...
[ "Mark", "this", "update", "as", "complete", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L139-L166
[ "def", "touch", "(", "self", ",", "connection", "=", "None", ")", ":", "self", ".", "create_marker_table", "(", ")", "if", "connection", "is", "None", ":", "# TODO: test this", "connection", "=", "self", ".", "connect", "(", ")", "connection", ".", "autoco...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
PostgresTarget.connect
Get a psycopg2 connection object to the database where the table is.
luigi/contrib/postgres.py
def connect(self): """ Get a psycopg2 connection object to the database where the table is. """ connection = psycopg2.connect( host=self.host, port=self.port, database=self.database, user=self.user, password=self.password) ...
def connect(self): """ Get a psycopg2 connection object to the database where the table is. """ connection = psycopg2.connect( host=self.host, port=self.port, database=self.database, user=self.user, password=self.password) ...
[ "Get", "a", "psycopg2", "connection", "object", "to", "the", "database", "where", "the", "table", "is", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L187-L198
[ "def", "connect", "(", "self", ")", ":", "connection", "=", "psycopg2", ".", "connect", "(", "host", "=", "self", ".", "host", ",", "port", "=", "self", ".", "port", ",", "database", "=", "self", ".", "database", ",", "user", "=", "self", ".", "use...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
PostgresTarget.create_marker_table
Create marker table if it doesn't exist. Using a separate connection since the transaction might have to be reset.
luigi/contrib/postgres.py
def create_marker_table(self): """ Create marker table if it doesn't exist. Using a separate connection since the transaction might have to be reset. """ connection = self.connect() connection.autocommit = True cursor = connection.cursor() if self.use_db_...
def create_marker_table(self): """ Create marker table if it doesn't exist. Using a separate connection since the transaction might have to be reset. """ connection = self.connect() connection.autocommit = True cursor = connection.cursor() if self.use_db_...
[ "Create", "marker", "table", "if", "it", "doesn", "t", "exist", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L200-L229
[ "def", "create_marker_table", "(", "self", ")", ":", "connection", "=", "self", ".", "connect", "(", ")", "connection", ".", "autocommit", "=", "True", "cursor", "=", "connection", ".", "cursor", "(", ")", "if", "self", ".", "use_db_timestamps", ":", "sql"...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
CopyToTable.rows
Return/yield tuples or lists corresponding to each row to be inserted.
luigi/contrib/postgres.py
def rows(self): """ Return/yield tuples or lists corresponding to each row to be inserted. """ with self.input().open('r') as fobj: for line in fobj: yield line.strip('\n').split('\t')
def rows(self): """ Return/yield tuples or lists corresponding to each row to be inserted. """ with self.input().open('r') as fobj: for line in fobj: yield line.strip('\n').split('\t')
[ "Return", "/", "yield", "tuples", "or", "lists", "corresponding", "to", "each", "row", "to", "be", "inserted", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L247-L253
[ "def", "rows", "(", "self", ")", ":", "with", "self", ".", "input", "(", ")", ".", "open", "(", "'r'", ")", "as", "fobj", ":", "for", "line", "in", "fobj", ":", "yield", "line", ".", "strip", "(", "'\\n'", ")", ".", "split", "(", "'\\t'", ")" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
CopyToTable.map_column
Applied to each column of every row returned by `rows`. Default behaviour is to escape special characters and identify any self.null_values.
luigi/contrib/postgres.py
def map_column(self, value): """ Applied to each column of every row returned by `rows`. Default behaviour is to escape special characters and identify any self.null_values. """ if value in self.null_values: return r'\\N' else: return default_esca...
def map_column(self, value): """ Applied to each column of every row returned by `rows`. Default behaviour is to escape special characters and identify any self.null_values. """ if value in self.null_values: return r'\\N' else: return default_esca...
[ "Applied", "to", "each", "column", "of", "every", "row", "returned", "by", "rows", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L255-L264
[ "def", "map_column", "(", "self", ",", "value", ")", ":", "if", "value", "in", "self", ".", "null_values", ":", "return", "r'\\\\N'", "else", ":", "return", "default_escape", "(", "six", ".", "text_type", "(", "value", ")", ")" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
CopyToTable.output
Returns a PostgresTarget representing the inserted dataset. Normally you don't override this.
luigi/contrib/postgres.py
def output(self): """ Returns a PostgresTarget representing the inserted dataset. Normally you don't override this. """ return PostgresTarget( host=self.host, database=self.database, user=self.user, password=self.password, ...
def output(self): """ Returns a PostgresTarget representing the inserted dataset. Normally you don't override this. """ return PostgresTarget( host=self.host, database=self.database, user=self.user, password=self.password, ...
[ "Returns", "a", "PostgresTarget", "representing", "the", "inserted", "dataset", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L268-L282
[ "def", "output", "(", "self", ")", ":", "return", "PostgresTarget", "(", "host", "=", "self", ".", "host", ",", "database", "=", "self", ".", "database", ",", "user", "=", "self", ".", "user", ",", "password", "=", "self", ".", "password", ",", "tabl...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
CopyToTable.run
Inserts data generated by rows() into target table. If the target table doesn't exist, self.create_table will be called to attempt to create the table. Normally you don't want to override this.
luigi/contrib/postgres.py
def run(self): """ Inserts data generated by rows() into target table. If the target table doesn't exist, self.create_table will be called to attempt to create the table. Normally you don't want to override this. """ if not (self.table and self.columns): rai...
def run(self): """ Inserts data generated by rows() into target table. If the target table doesn't exist, self.create_table will be called to attempt to create the table. Normally you don't want to override this. """ if not (self.table and self.columns): rai...
[ "Inserts", "data", "generated", "by", "rows", "()", "into", "target", "table", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L293-L349
[ "def", "run", "(", "self", ")", ":", "if", "not", "(", "self", ".", "table", "and", "self", ".", "columns", ")", ":", "raise", "Exception", "(", "\"table and columns need to be specified\"", ")", "connection", "=", "self", ".", "output", "(", ")", ".", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
get_config
Get configs singleton for parser
luigi/configuration/core.py
def get_config(parser=PARSER): """Get configs singleton for parser """ parser_class = PARSERS[parser] _check_parser(parser_class, parser) return parser_class.instance()
def get_config(parser=PARSER): """Get configs singleton for parser """ parser_class = PARSERS[parser] _check_parser(parser_class, parser) return parser_class.instance()
[ "Get", "configs", "singleton", "for", "parser" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/configuration/core.py#L53-L58
[ "def", "get_config", "(", "parser", "=", "PARSER", ")", ":", "parser_class", "=", "PARSERS", "[", "parser", "]", "_check_parser", "(", "parser_class", ",", "parser", ")", "return", "parser_class", ".", "instance", "(", ")" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
add_config_path
Select config parser by file extension and add path into parser.
luigi/configuration/core.py
def add_config_path(path): """Select config parser by file extension and add path into parser. """ if not os.path.isfile(path): warnings.warn("Config file does not exist: {path}".format(path=path)) return False # select parser by file extension _base, ext = os.path.splitext(path) ...
def add_config_path(path): """Select config parser by file extension and add path into parser. """ if not os.path.isfile(path): warnings.warn("Config file does not exist: {path}".format(path=path)) return False # select parser by file extension _base, ext = os.path.splitext(path) ...
[ "Select", "config", "parser", "by", "file", "extension", "and", "add", "path", "into", "parser", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/configuration/core.py#L61-L87
[ "def", "add_config_path", "(", "path", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "warnings", ".", "warn", "(", "\"Config file does not exist: {path}\"", ".", "format", "(", "path", "=", "path", ")", ")", "return", "F...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
PySparkTask._setup_packages
This method compresses and uploads packages to the cluster
luigi/contrib/spark.py
def _setup_packages(self, sc): """ This method compresses and uploads packages to the cluster """ packages = self.py_packages if not packages: return for package in packages: mod = importlib.import_module(package) try: ...
def _setup_packages(self, sc): """ This method compresses and uploads packages to the cluster """ packages = self.py_packages if not packages: return for package in packages: mod = importlib.import_module(package) try: ...
[ "This", "method", "compresses", "and", "uploads", "packages", "to", "the", "cluster" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/spark.py#L323-L341
[ "def", "_setup_packages", "(", "self", ",", "sc", ")", ":", "packages", "=", "self", ".", "py_packages", "if", "not", "packages", ":", "return", "for", "package", "in", "packages", ":", "mod", "=", "importlib", ".", "import_module", "(", "package", ")", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
main
Run either the mapper, combiner, or reducer from the class instance in the file "job-instance.pickle". Arguments: kind -- is either map, combiner, or reduce
luigi/contrib/mrrunner.py
def main(args=None, stdin=sys.stdin, stdout=sys.stdout, print_exception=print_exception): """ Run either the mapper, combiner, or reducer from the class instance in the file "job-instance.pickle". Arguments: kind -- is either map, combiner, or reduce """ try: # Set up logging. ...
def main(args=None, stdin=sys.stdin, stdout=sys.stdout, print_exception=print_exception): """ Run either the mapper, combiner, or reducer from the class instance in the file "job-instance.pickle". Arguments: kind -- is either map, combiner, or reduce """ try: # Set up logging. ...
[ "Run", "either", "the", "mapper", "combiner", "or", "reducer", "from", "the", "class", "instance", "in", "the", "file", "job", "-", "instance", ".", "pickle", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mrrunner.py#L80-L97
[ "def", "main", "(", "args", "=", "None", ",", "stdin", "=", "sys", ".", "stdin", ",", "stdout", "=", "sys", ".", "stdout", ",", "print_exception", "=", "print_exception", ")", ":", "try", ":", "# Set up logging.", "logging", ".", "basicConfig", "(", "lev...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
run_with_retcodes
Run luigi with command line parsing, but raise ``SystemExit`` with the configured exit code. Note: Usually you use the luigi binary directly and don't call this function yourself. :param argv: Should (conceptually) be ``sys.argv[1:]``
luigi/retcodes.py
def run_with_retcodes(argv): """ Run luigi with command line parsing, but raise ``SystemExit`` with the configured exit code. Note: Usually you use the luigi binary directly and don't call this function yourself. :param argv: Should (conceptually) be ``sys.argv[1:]`` """ logger = logging.getLo...
def run_with_retcodes(argv): """ Run luigi with command line parsing, but raise ``SystemExit`` with the configured exit code. Note: Usually you use the luigi binary directly and don't call this function yourself. :param argv: Should (conceptually) be ``sys.argv[1:]`` """ logger = logging.getLo...
[ "Run", "luigi", "with", "command", "line", "parsing", "but", "raise", "SystemExit", "with", "the", "configured", "exit", "code", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/retcodes.py#L61-L108
[ "def", "run_with_retcodes", "(", "argv", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "'luigi-interface'", ")", "with", "luigi", ".", "cmdline_parser", ".", "CmdlineParser", ".", "global_instance", "(", "argv", ")", ":", "retcodes", "=", "retcode...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
find_deps_cli
Finds all tasks on all paths from provided CLI task
luigi/tools/deps.py
def find_deps_cli(): ''' Finds all tasks on all paths from provided CLI task ''' cmdline_args = sys.argv[1:] with CmdlineParser.global_instance(cmdline_args) as cp: return find_deps(cp.get_task_obj(), upstream().family)
def find_deps_cli(): ''' Finds all tasks on all paths from provided CLI task ''' cmdline_args = sys.argv[1:] with CmdlineParser.global_instance(cmdline_args) as cp: return find_deps(cp.get_task_obj(), upstream().family)
[ "Finds", "all", "tasks", "on", "all", "paths", "from", "provided", "CLI", "task" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/deps.py#L85-L91
[ "def", "find_deps_cli", "(", ")", ":", "cmdline_args", "=", "sys", ".", "argv", "[", "1", ":", "]", "with", "CmdlineParser", ".", "global_instance", "(", "cmdline_args", ")", "as", "cp", ":", "return", "find_deps", "(", "cp", ".", "get_task_obj", "(", ")...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
get_task_output_description
Returns a task's output as a string
luigi/tools/deps.py
def get_task_output_description(task_output): ''' Returns a task's output as a string ''' output_description = "n/a" if isinstance(task_output, RemoteTarget): output_description = "[SSH] {0}:{1}".format(task_output._fs.remote_context.host, task_output.path) elif isinstance(task_output, ...
def get_task_output_description(task_output): ''' Returns a task's output as a string ''' output_description = "n/a" if isinstance(task_output, RemoteTarget): output_description = "[SSH] {0}:{1}".format(task_output._fs.remote_context.host, task_output.path) elif isinstance(task_output, ...
[ "Returns", "a", "task", "s", "output", "as", "a", "string" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/deps.py#L94-L111
[ "def", "get_task_output_description", "(", "task_output", ")", ":", "output_description", "=", "\"n/a\"", "if", "isinstance", "(", "task_output", ",", "RemoteTarget", ")", ":", "output_description", "=", "\"[SSH] {0}:{1}\"", ".", "format", "(", "task_output", ".", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
_constrain_glob
Tweaks glob into a list of more specific globs that together still cover paths and not too much extra. Saves us minutes long listings for long dataset histories. Specifically, in this implementation the leftmost occurrences of "[0-9]" give rise to a few separate globs that each specialize the expression t...
luigi/tools/range.py
def _constrain_glob(glob, paths, limit=5): """ Tweaks glob into a list of more specific globs that together still cover paths and not too much extra. Saves us minutes long listings for long dataset histories. Specifically, in this implementation the leftmost occurrences of "[0-9]" give rise to a f...
def _constrain_glob(glob, paths, limit=5): """ Tweaks glob into a list of more specific globs that together still cover paths and not too much extra. Saves us minutes long listings for long dataset histories. Specifically, in this implementation the leftmost occurrences of "[0-9]" give rise to a f...
[ "Tweaks", "glob", "into", "a", "list", "of", "more", "specific", "globs", "that", "together", "still", "cover", "paths", "and", "not", "too", "much", "extra", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L491-L528
[ "def", "_constrain_glob", "(", "glob", ",", "paths", ",", "limit", "=", "5", ")", ":", "def", "digit_set_wildcard", "(", "chars", ")", ":", "\"\"\"\n Makes a wildcard expression for the set, a bit readable, e.g. [1-5].\n \"\"\"", "chars", "=", "sorted", "(",...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
most_common
Wanted functionality from Counters (new in Python 2.7).
luigi/tools/range.py
def most_common(items): """ Wanted functionality from Counters (new in Python 2.7). """ counts = {} for i in items: counts.setdefault(i, 0) counts[i] += 1 return max(six.iteritems(counts), key=operator.itemgetter(1))
def most_common(items): """ Wanted functionality from Counters (new in Python 2.7). """ counts = {} for i in items: counts.setdefault(i, 0) counts[i] += 1 return max(six.iteritems(counts), key=operator.itemgetter(1))
[ "Wanted", "functionality", "from", "Counters", "(", "new", "in", "Python", "2", ".", "7", ")", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L531-L539
[ "def", "most_common", "(", "items", ")", ":", "counts", "=", "{", "}", "for", "i", "in", "items", ":", "counts", ".", "setdefault", "(", "i", ",", "0", ")", "counts", "[", "i", "]", "+=", "1", "return", "max", "(", "six", ".", "iteritems", "(", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
_get_per_location_glob
Builds a glob listing existing output paths. Esoteric reverse engineering, but worth it given that (compared to an equivalent contiguousness guarantee by naive complete() checks) requests to the filesystem are cut by orders of magnitude, and users don't even have to retrofit existing tasks anyhow.
luigi/tools/range.py
def _get_per_location_glob(tasks, outputs, regexes): """ Builds a glob listing existing output paths. Esoteric reverse engineering, but worth it given that (compared to an equivalent contiguousness guarantee by naive complete() checks) requests to the filesystem are cut by orders of magnitude, and ...
def _get_per_location_glob(tasks, outputs, regexes): """ Builds a glob listing existing output paths. Esoteric reverse engineering, but worth it given that (compared to an equivalent contiguousness guarantee by naive complete() checks) requests to the filesystem are cut by orders of magnitude, and ...
[ "Builds", "a", "glob", "listing", "existing", "output", "paths", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L542-L570
[ "def", "_get_per_location_glob", "(", "tasks", ",", "outputs", ",", "regexes", ")", ":", "paths", "=", "[", "o", ".", "path", "for", "o", "in", "outputs", "]", "# naive, because some matches could be confused by numbers earlier", "# in path, e.g. /foo/fifa2000k/bar/2000-1...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
_get_filesystems_and_globs
Yields a (filesystem, glob) tuple per every output location of task. The task can have one or several FileSystemTarget outputs. For convenience, the task can be a luigi.WrapperTask, in which case outputs of all its dependencies are considered.
luigi/tools/range.py
def _get_filesystems_and_globs(datetime_to_task, datetime_to_re): """ Yields a (filesystem, glob) tuple per every output location of task. The task can have one or several FileSystemTarget outputs. For convenience, the task can be a luigi.WrapperTask, in which case outputs of all its dependencies ...
def _get_filesystems_and_globs(datetime_to_task, datetime_to_re): """ Yields a (filesystem, glob) tuple per every output location of task. The task can have one or several FileSystemTarget outputs. For convenience, the task can be a luigi.WrapperTask, in which case outputs of all its dependencies ...
[ "Yields", "a", "(", "filesystem", "glob", ")", "tuple", "per", "every", "output", "location", "of", "task", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L573-L600
[ "def", "_get_filesystems_and_globs", "(", "datetime_to_task", ",", "datetime_to_re", ")", ":", "# probe some scattered datetimes unlikely to all occur in paths, other than by being sincere datetime parameter's representations", "# TODO limit to [self.start, self.stop) so messages are less confusin...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
_list_existing
Get all the paths that do in fact exist. Returns a set of all existing paths. Takes a luigi.target.FileSystem object, a str which represents a glob and a list of strings representing paths.
luigi/tools/range.py
def _list_existing(filesystem, glob, paths): """ Get all the paths that do in fact exist. Returns a set of all existing paths. Takes a luigi.target.FileSystem object, a str which represents a glob and a list of strings representing paths. """ globs = _constrain_glob(glob, paths) time_start ...
def _list_existing(filesystem, glob, paths): """ Get all the paths that do in fact exist. Returns a set of all existing paths. Takes a luigi.target.FileSystem object, a str which represents a glob and a list of strings representing paths. """ globs = _constrain_glob(glob, paths) time_start ...
[ "Get", "all", "the", "paths", "that", "do", "in", "fact", "exist", ".", "Returns", "a", "set", "of", "all", "existing", "paths", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L603-L619
[ "def", "_list_existing", "(", "filesystem", ",", "glob", ",", "paths", ")", ":", "globs", "=", "_constrain_glob", "(", "glob", ",", "paths", ")", "time_start", "=", "time", ".", "time", "(", ")", "listing", "=", "[", "]", "for", "g", "in", "sorted", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
infer_bulk_complete_from_fs
Efficiently determines missing datetimes by filesystem listing. The current implementation works for the common case of a task writing output to a ``FileSystemTarget`` whose path is built using strftime with format like '...%Y...%m...%d...%H...', without custom ``complete()`` or ``exists()``. (Eve...
luigi/tools/range.py
def infer_bulk_complete_from_fs(datetimes, datetime_to_task, datetime_to_re): """ Efficiently determines missing datetimes by filesystem listing. The current implementation works for the common case of a task writing output to a ``FileSystemTarget`` whose path is built using strftime with format li...
def infer_bulk_complete_from_fs(datetimes, datetime_to_task, datetime_to_re): """ Efficiently determines missing datetimes by filesystem listing. The current implementation works for the common case of a task writing output to a ``FileSystemTarget`` whose path is built using strftime with format li...
[ "Efficiently", "determines", "missing", "datetimes", "by", "filesystem", "listing", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L622-L647
[ "def", "infer_bulk_complete_from_fs", "(", "datetimes", ",", "datetime_to_task", ",", "datetime_to_re", ")", ":", "filesystems_and_globs_by_location", "=", "_get_filesystems_and_globs", "(", "datetime_to_task", ",", "datetime_to_re", ")", "paths_by_datetime", "=", "[", "[",...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
RangeBase.of_cls
DONT USE. Will be deleted soon. Use ``self.of``!
luigi/tools/range.py
def of_cls(self): """ DONT USE. Will be deleted soon. Use ``self.of``! """ if isinstance(self.of, six.string_types): warnings.warn('When using Range programatically, dont pass "of" param as string!') return Register.get_task_cls(self.of) return self.of
def of_cls(self): """ DONT USE. Will be deleted soon. Use ``self.of``! """ if isinstance(self.of, six.string_types): warnings.warn('When using Range programatically, dont pass "of" param as string!') return Register.get_task_cls(self.of) return self.of
[ "DONT", "USE", ".", "Will", "be", "deleted", "soon", ".", "Use", "self", ".", "of", "!" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L117-L124
[ "def", "of_cls", "(", "self", ")", ":", "if", "isinstance", "(", "self", ".", "of", ",", "six", ".", "string_types", ")", ":", "warnings", ".", "warn", "(", "'When using Range programatically, dont pass \"of\" param as string!'", ")", "return", "Register", ".", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
RangeBase._emit_metrics
For consistent metrics one should consider the entire range, but it is open (infinite) if stop or start is None. Hence make do with metrics respective to the finite simplification.
luigi/tools/range.py
def _emit_metrics(self, missing_datetimes, finite_start, finite_stop): """ For consistent metrics one should consider the entire range, but it is open (infinite) if stop or start is None. Hence make do with metrics respective to the finite simplification. """ datetimes =...
def _emit_metrics(self, missing_datetimes, finite_start, finite_stop): """ For consistent metrics one should consider the entire range, but it is open (infinite) if stop or start is None. Hence make do with metrics respective to the finite simplification. """ datetimes =...
[ "For", "consistent", "metrics", "one", "should", "consider", "the", "entire", "range", "but", "it", "is", "open", "(", "infinite", ")", "if", "stop", "or", "start", "is", "None", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L166-L183
[ "def", "_emit_metrics", "(", "self", ",", "missing_datetimes", ",", "finite_start", ",", "finite_stop", ")", ":", "datetimes", "=", "self", ".", "finite_datetimes", "(", "finite_start", "if", "self", ".", "start", "is", "None", "else", "min", "(", "finite_star...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
RangeBase.missing_datetimes
Override in subclasses to do bulk checks. Returns a sorted list. This is a conservative base implementation that brutally checks completeness, instance by instance. Inadvisable as it may be slow.
luigi/tools/range.py
def missing_datetimes(self, finite_datetimes): """ Override in subclasses to do bulk checks. Returns a sorted list. This is a conservative base implementation that brutally checks completeness, instance by instance. Inadvisable as it may be slow. """ return [d ...
def missing_datetimes(self, finite_datetimes): """ Override in subclasses to do bulk checks. Returns a sorted list. This is a conservative base implementation that brutally checks completeness, instance by instance. Inadvisable as it may be slow. """ return [d ...
[ "Override", "in", "subclasses", "to", "do", "bulk", "checks", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L255-L265
[ "def", "missing_datetimes", "(", "self", ",", "finite_datetimes", ")", ":", "return", "[", "d", "for", "d", "in", "finite_datetimes", "if", "not", "self", ".", "_instantiate_task_cls", "(", "self", ".", "datetime_to_parameter", "(", "d", ")", ")", ".", "comp...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
RangeBase._missing_datetimes
Backward compatible wrapper. Will be deleted eventually (stated on Dec 2015)
luigi/tools/range.py
def _missing_datetimes(self, finite_datetimes): """ Backward compatible wrapper. Will be deleted eventually (stated on Dec 2015) """ try: return self.missing_datetimes(finite_datetimes) except TypeError as ex: if 'missing_datetimes()' in repr(ex): ...
def _missing_datetimes(self, finite_datetimes): """ Backward compatible wrapper. Will be deleted eventually (stated on Dec 2015) """ try: return self.missing_datetimes(finite_datetimes) except TypeError as ex: if 'missing_datetimes()' in repr(ex): ...
[ "Backward", "compatible", "wrapper", ".", "Will", "be", "deleted", "eventually", "(", "stated", "on", "Dec", "2015", ")" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L267-L278
[ "def", "_missing_datetimes", "(", "self", ",", "finite_datetimes", ")", ":", "try", ":", "return", "self", ".", "missing_datetimes", "(", "finite_datetimes", ")", "except", "TypeError", "as", "ex", ":", "if", "'missing_datetimes()'", "in", "repr", "(", "ex", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
RangeDailyBase.parameters_to_datetime
Given a dictionary of parameters, will extract the ranged task parameter value
luigi/tools/range.py
def parameters_to_datetime(self, p): """ Given a dictionary of parameters, will extract the ranged task parameter value """ dt = p[self._param_name] return datetime(dt.year, dt.month, dt.day)
def parameters_to_datetime(self, p): """ Given a dictionary of parameters, will extract the ranged task parameter value """ dt = p[self._param_name] return datetime(dt.year, dt.month, dt.day)
[ "Given", "a", "dictionary", "of", "parameters", "will", "extract", "the", "ranged", "task", "parameter", "value" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L316-L321
[ "def", "parameters_to_datetime", "(", "self", ",", "p", ")", ":", "dt", "=", "p", "[", "self", ".", "_param_name", "]", "return", "datetime", "(", "dt", ".", "year", ",", "dt", ".", "month", ",", "dt", ".", "day", ")" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
RangeDailyBase.finite_datetimes
Simply returns the points in time that correspond to turn of day.
luigi/tools/range.py
def finite_datetimes(self, finite_start, finite_stop): """ Simply returns the points in time that correspond to turn of day. """ date_start = datetime(finite_start.year, finite_start.month, finite_start.day) dates = [] for i in itertools.count(): t = date_star...
def finite_datetimes(self, finite_start, finite_stop): """ Simply returns the points in time that correspond to turn of day. """ date_start = datetime(finite_start.year, finite_start.month, finite_start.day) dates = [] for i in itertools.count(): t = date_star...
[ "Simply", "returns", "the", "points", "in", "time", "that", "correspond", "to", "turn", "of", "day", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L329-L340
[ "def", "finite_datetimes", "(", "self", ",", "finite_start", ",", "finite_stop", ")", ":", "date_start", "=", "datetime", "(", "finite_start", ".", "year", ",", "finite_start", ".", "month", ",", "finite_start", ".", "day", ")", "dates", "=", "[", "]", "fo...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
RangeHourlyBase.finite_datetimes
Simply returns the points in time that correspond to whole hours.
luigi/tools/range.py
def finite_datetimes(self, finite_start, finite_stop): """ Simply returns the points in time that correspond to whole hours. """ datehour_start = datetime(finite_start.year, finite_start.month, finite_start.day, finite_start.hour) datehours = [] for i in itertools.count()...
def finite_datetimes(self, finite_start, finite_stop): """ Simply returns the points in time that correspond to whole hours. """ datehour_start = datetime(finite_start.year, finite_start.month, finite_start.day, finite_start.hour) datehours = [] for i in itertools.count()...
[ "Simply", "returns", "the", "points", "in", "time", "that", "correspond", "to", "whole", "hours", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L391-L402
[ "def", "finite_datetimes", "(", "self", ",", "finite_start", ",", "finite_stop", ")", ":", "datehour_start", "=", "datetime", "(", "finite_start", ".", "year", ",", "finite_start", ".", "month", ",", "finite_start", ".", "day", ",", "finite_start", ".", "hour"...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
RangeByMinutesBase.finite_datetimes
Simply returns the points in time that correspond to a whole number of minutes intervals.
luigi/tools/range.py
def finite_datetimes(self, finite_start, finite_stop): """ Simply returns the points in time that correspond to a whole number of minutes intervals. """ # Validate that the minutes_interval can divide 60 and it is greater than 0 and lesser than 60 if not (0 < self.minutes_interva...
def finite_datetimes(self, finite_start, finite_stop): """ Simply returns the points in time that correspond to a whole number of minutes intervals. """ # Validate that the minutes_interval can divide 60 and it is greater than 0 and lesser than 60 if not (0 < self.minutes_interva...
[ "Simply", "returns", "the", "points", "in", "time", "that", "correspond", "to", "a", "whole", "number", "of", "minutes", "intervals", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L462-L485
[ "def", "finite_datetimes", "(", "self", ",", "finite_start", ",", "finite_stop", ")", ":", "# Validate that the minutes_interval can divide 60 and it is greater than 0 and lesser than 60", "if", "not", "(", "0", "<", "self", ".", "minutes_interval", "<", "60", ")", ":", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
RangeMonthly.finite_datetimes
Simply returns the points in time that correspond to turn of month.
luigi/tools/range.py
def finite_datetimes(self, finite_start, finite_stop): """ Simply returns the points in time that correspond to turn of month. """ start_date = self._align(finite_start) aligned_stop = self._align(finite_stop) dates = [] for m in itertools.count(): t =...
def finite_datetimes(self, finite_start, finite_stop): """ Simply returns the points in time that correspond to turn of month. """ start_date = self._align(finite_start) aligned_stop = self._align(finite_stop) dates = [] for m in itertools.count(): t =...
[ "Simply", "returns", "the", "points", "in", "time", "that", "correspond", "to", "turn", "of", "month", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L709-L721
[ "def", "finite_datetimes", "(", "self", ",", "finite_start", ",", "finite_stop", ")", ":", "start_date", "=", "self", ".", "_align", "(", "finite_start", ")", "aligned_stop", "=", "self", ".", "_align", "(", "finite_stop", ")", "dates", "=", "[", "]", "for...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
MSSqlTarget.touch
Mark this update as complete. IMPORTANT, If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created.
luigi/contrib/mssqldb.py
def touch(self, connection=None): """ Mark this update as complete. IMPORTANT, If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created. """ self.create_marker_table() i...
def touch(self, connection=None): """ Mark this update as complete. IMPORTANT, If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created. """ self.create_marker_table() i...
[ "Mark", "this", "update", "as", "complete", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mssqldb.py#L71-L100
[ "def", "touch", "(", "self", ",", "connection", "=", "None", ")", ":", "self", ".", "create_marker_table", "(", ")", "if", "connection", "is", "None", ":", "connection", "=", "self", ".", "connect", "(", ")", "connection", ".", "execute_non_query", "(", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
MSSqlTarget.connect
Create a SQL Server connection and return a connection object
luigi/contrib/mssqldb.py
def connect(self): """ Create a SQL Server connection and return a connection object """ connection = _mssql.connect(user=self.user, password=self.password, server=self.host, port=...
def connect(self): """ Create a SQL Server connection and return a connection object """ connection = _mssql.connect(user=self.user, password=self.password, server=self.host, port=...
[ "Create", "a", "SQL", "Server", "connection", "and", "return", "a", "connection", "object" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mssqldb.py#L119-L128
[ "def", "connect", "(", "self", ")", ":", "connection", "=", "_mssql", ".", "connect", "(", "user", "=", "self", ".", "user", ",", "password", "=", "self", ".", "password", ",", "server", "=", "self", ".", "host", ",", "port", "=", "self", ".", "por...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
MSSqlTarget.create_marker_table
Create marker table if it doesn't exist. Use a separate connection since the transaction might have to be reset.
luigi/contrib/mssqldb.py
def create_marker_table(self): """ Create marker table if it doesn't exist. Use a separate connection since the transaction might have to be reset. """ connection = self.connect() try: connection.execute_non_query( """ CREATE TABLE {marker_tabl...
def create_marker_table(self): """ Create marker table if it doesn't exist. Use a separate connection since the transaction might have to be reset. """ connection = self.connect() try: connection.execute_non_query( """ CREATE TABLE {marker_tabl...
[ "Create", "marker", "table", "if", "it", "doesn", "t", "exist", ".", "Use", "a", "separate", "connection", "since", "the", "transaction", "might", "have", "to", "be", "reset", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mssqldb.py#L130-L154
[ "def", "create_marker_table", "(", "self", ")", ":", "connection", "=", "self", ".", "connect", "(", ")", "try", ":", "connection", ".", "execute_non_query", "(", "\"\"\" CREATE TABLE {marker_table} (\n id BIGINT NOT NULL IDENTITY(1,1),\n ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
OpenerRegistry.get_opener
Retrieve an opener for the given protocol :param name: name of the opener to open :type name: string :raises NoOpenerError: if no opener has been registered of that name
luigi/contrib/opener.py
def get_opener(self, name): """Retrieve an opener for the given protocol :param name: name of the opener to open :type name: string :raises NoOpenerError: if no opener has been registered of that name """ if name not in self.registry: raise NoOpenerError("No...
def get_opener(self, name): """Retrieve an opener for the given protocol :param name: name of the opener to open :type name: string :raises NoOpenerError: if no opener has been registered of that name """ if name not in self.registry: raise NoOpenerError("No...
[ "Retrieve", "an", "opener", "for", "the", "given", "protocol" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/opener.py#L89-L100
[ "def", "get_opener", "(", "self", ",", "name", ")", ":", "if", "name", "not", "in", "self", ".", "registry", ":", "raise", "NoOpenerError", "(", "\"No opener for %s\"", "%", "name", ")", "index", "=", "self", ".", "registry", "[", "name", "]", "return", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
OpenerRegistry.add
Adds an opener to the registry :param opener: Opener object :type opener: Opener inherited object
luigi/contrib/opener.py
def add(self, opener): """Adds an opener to the registry :param opener: Opener object :type opener: Opener inherited object """ index = len(self.openers) self.openers[index] = opener for name in opener.names: self.registry[name] = index
def add(self, opener): """Adds an opener to the registry :param opener: Opener object :type opener: Opener inherited object """ index = len(self.openers) self.openers[index] = opener for name in opener.names: self.registry[name] = index
[ "Adds", "an", "opener", "to", "the", "registry" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/opener.py#L102-L113
[ "def", "add", "(", "self", ",", "opener", ")", ":", "index", "=", "len", "(", "self", ".", "openers", ")", "self", ".", "openers", "[", "index", "]", "=", "opener", "for", "name", "in", "opener", ".", "names", ":", "self", ".", "registry", "[", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
OpenerRegistry.open
Open target uri. :param target_uri: Uri to open :type target_uri: string :returns: Target object
luigi/contrib/opener.py
def open(self, target_uri, **kwargs): """Open target uri. :param target_uri: Uri to open :type target_uri: string :returns: Target object """ target = urlsplit(target_uri, scheme=self.default_opener) opener = self.get_opener(target.scheme) query = open...
def open(self, target_uri, **kwargs): """Open target uri. :param target_uri: Uri to open :type target_uri: string :returns: Target object """ target = urlsplit(target_uri, scheme=self.default_opener) opener = self.get_opener(target.scheme) query = open...
[ "Open", "target", "uri", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/opener.py#L115-L142
[ "def", "open", "(", "self", ",", "target_uri", ",", "*", "*", "kwargs", ")", ":", "target", "=", "urlsplit", "(", "target_uri", ",", "scheme", "=", "self", ".", "default_opener", ")", "opener", "=", "self", ".", "get_opener", "(", "target", ".", "schem...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
Opener.conform_query
Converts the query string from a target uri, uses cls.allowed_kwargs, and cls.filter_kwargs to drive logic. :param query: Unparsed query string :type query: urllib.parse.unsplit(uri).query :returns: Dictionary of parsed values, everything in cls.allowed_kwargs with values se...
luigi/contrib/opener.py
def conform_query(cls, query): """Converts the query string from a target uri, uses cls.allowed_kwargs, and cls.filter_kwargs to drive logic. :param query: Unparsed query string :type query: urllib.parse.unsplit(uri).query :returns: Dictionary of parsed values, everything in cls...
def conform_query(cls, query): """Converts the query string from a target uri, uses cls.allowed_kwargs, and cls.filter_kwargs to drive logic. :param query: Unparsed query string :type query: urllib.parse.unsplit(uri).query :returns: Dictionary of parsed values, everything in cls...
[ "Converts", "the", "query", "string", "from", "a", "target", "uri", "uses", "cls", ".", "allowed_kwargs", "and", "cls", ".", "filter_kwargs", "to", "drive", "logic", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/opener.py#L157-L183
[ "def", "conform_query", "(", "cls", ",", "query", ")", ":", "query", "=", "parse_qs", "(", "query", ",", "keep_blank_values", "=", "True", ")", "# Remove any unexpected keywords from the query string.", "if", "cls", ".", "filter_kwargs", ":", "query", "=", "{", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
Opener.get_target
Override this method to use values from the parsed uri to initialize the expected target.
luigi/contrib/opener.py
def get_target(cls, scheme, path, fragment, username, password, hostname, port, query, **kwargs): """Override this method to use values from the parsed uri to initialize the expected target. """ raise NotImplementedError("get_target must be overridden")
def get_target(cls, scheme, path, fragment, username, password, hostname, port, query, **kwargs): """Override this method to use values from the parsed uri to initialize the expected target. """ raise NotImplementedError("get_target must be overridden")
[ "Override", "this", "method", "to", "use", "values", "from", "the", "parsed", "uri", "to", "initialize", "the", "expected", "target", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/opener.py#L186-L192
[ "def", "get_target", "(", "cls", ",", "scheme", ",", "path", ",", "fragment", ",", "username", ",", "password", ",", "hostname", ",", "port", ",", "query", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"get_target must be overridd...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
_schedule_and_run
:param tasks: :param worker_scheduler_factory: :param override_defaults: :return: True if all tasks and their dependencies were successfully run (or already completed); False if any error occurred. It will return a detailed response of type LuigiRunResult instead of a boolean if de...
luigi/interface.py
def _schedule_and_run(tasks, worker_scheduler_factory=None, override_defaults=None): """ :param tasks: :param worker_scheduler_factory: :param override_defaults: :return: True if all tasks and their dependencies were successfully run (or already completed); False if any error occurred. ...
def _schedule_and_run(tasks, worker_scheduler_factory=None, override_defaults=None): """ :param tasks: :param worker_scheduler_factory: :param override_defaults: :return: True if all tasks and their dependencies were successfully run (or already completed); False if any error occurred. ...
[ ":", "param", "tasks", ":", ":", "param", "worker_scheduler_factory", ":", ":", "param", "override_defaults", ":", ":", "return", ":", "True", "if", "all", "tasks", "and", "their", "dependencies", "were", "successfully", "run", "(", "or", "already", "completed...
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/interface.py#L129-L176
[ "def", "_schedule_and_run", "(", "tasks", ",", "worker_scheduler_factory", "=", "None", ",", "override_defaults", "=", "None", ")", ":", "if", "worker_scheduler_factory", "is", "None", ":", "worker_scheduler_factory", "=", "_WorkerSchedulerFactory", "(", ")", "if", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
run
Please dont use. Instead use `luigi` binary. Run from cmdline using argparse. :param use_dynamic_argparse: Deprecated and ignored
luigi/interface.py
def run(*args, **kwargs): """ Please dont use. Instead use `luigi` binary. Run from cmdline using argparse. :param use_dynamic_argparse: Deprecated and ignored """ luigi_run_result = _run(*args, **kwargs) return luigi_run_result if kwargs.get('detailed_summary') else luigi_run_result.sched...
def run(*args, **kwargs): """ Please dont use. Instead use `luigi` binary. Run from cmdline using argparse. :param use_dynamic_argparse: Deprecated and ignored """ luigi_run_result = _run(*args, **kwargs) return luigi_run_result if kwargs.get('detailed_summary') else luigi_run_result.sched...
[ "Please", "dont", "use", ".", "Instead", "use", "luigi", "binary", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/interface.py#L186-L195
[ "def", "run", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "luigi_run_result", "=", "_run", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "luigi_run_result", "if", "kwargs", ".", "get", "(", "'detailed_summary'", ")", "else", "luigi...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
build
Run internally, bypassing the cmdline parsing. Useful if you have some luigi code that you want to run internally. Example: .. code-block:: python luigi.build([MyTask1(), MyTask2()], local_scheduler=True) One notable difference is that `build` defaults to not using the identical process ...
luigi/interface.py
def build(tasks, worker_scheduler_factory=None, detailed_summary=False, **env_params): """ Run internally, bypassing the cmdline parsing. Useful if you have some luigi code that you want to run internally. Example: .. code-block:: python luigi.build([MyTask1(), MyTask2()], local_scheduler...
def build(tasks, worker_scheduler_factory=None, detailed_summary=False, **env_params): """ Run internally, bypassing the cmdline parsing. Useful if you have some luigi code that you want to run internally. Example: .. code-block:: python luigi.build([MyTask1(), MyTask2()], local_scheduler...
[ "Run", "internally", "bypassing", "the", "cmdline", "parsing", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/interface.py#L214-L238
[ "def", "build", "(", "tasks", ",", "worker_scheduler_factory", "=", "None", ",", "detailed_summary", "=", "False", ",", "*", "*", "env_params", ")", ":", "if", "\"no_lock\"", "not", "in", "env_params", ":", "env_params", "[", "\"no_lock\"", "]", "=", "True",...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
MySqlTarget.touch
Mark this update as complete. IMPORTANT, If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created.
luigi/contrib/mysqldb.py
def touch(self, connection=None): """ Mark this update as complete. IMPORTANT, If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created. """ self.create_marker_table() i...
def touch(self, connection=None): """ Mark this update as complete. IMPORTANT, If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created. """ self.create_marker_table() i...
[ "Mark", "this", "update", "as", "complete", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mysqldb.py#L71-L94
[ "def", "touch", "(", "self", ",", "connection", "=", "None", ")", ":", "self", ".", "create_marker_table", "(", ")", "if", "connection", "is", "None", ":", "connection", "=", "self", ".", "connect", "(", ")", "connection", ".", "autocommit", "=", "True",...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
MySqlTarget.create_marker_table
Create marker table if it doesn't exist. Using a separate connection since the transaction might have to be reset.
luigi/contrib/mysqldb.py
def create_marker_table(self): """ Create marker table if it doesn't exist. Using a separate connection since the transaction might have to be reset. """ connection = self.connect(autocommit=True) cursor = connection.cursor() try: cursor.execute( ...
def create_marker_table(self): """ Create marker table if it doesn't exist. Using a separate connection since the transaction might have to be reset. """ connection = self.connect(autocommit=True) cursor = connection.cursor() try: cursor.execute( ...
[ "Create", "marker", "table", "if", "it", "doesn", "t", "exist", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mysqldb.py#L125-L151
[ "def", "create_marker_table", "(", "self", ")", ":", "connection", "=", "self", ".", "connect", "(", "autocommit", "=", "True", ")", "cursor", "=", "connection", ".", "cursor", "(", ")", "try", ":", "cursor", ".", "execute", "(", "\"\"\" CREATE TABLE {marker...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
CopyToTable.run
Inserts data generated by rows() into target table. If the target table doesn't exist, self.create_table will be called to attempt to create the table. Normally you don't want to override this.
luigi/contrib/mysqldb.py
def run(self): """ Inserts data generated by rows() into target table. If the target table doesn't exist, self.create_table will be called to attempt to create the table. Normally you don't want to override this. """ if not (self.table and self.columns): rai...
def run(self): """ Inserts data generated by rows() into target table. If the target table doesn't exist, self.create_table will be called to attempt to create the table. Normally you don't want to override this. """ if not (self.table and self.columns): rai...
[ "Inserts", "data", "generated", "by", "rows", "()", "into", "target", "table", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mysqldb.py#L207-L246
[ "def", "run", "(", "self", ")", ":", "if", "not", "(", "self", ".", "table", "and", "self", ".", "columns", ")", ":", "raise", "Exception", "(", "\"table and columns need to be specified\"", ")", "connection", "=", "self", ".", "output", "(", ")", ".", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
fix_paths
Coerce input arguments to use temporary files when used for output. Return a list of temporary file pairs (tmpfile, destination path) and a list of arguments. Converts each HdfsTarget to a string for the path.
luigi/contrib/hadoop_jar.py
def fix_paths(job): """ Coerce input arguments to use temporary files when used for output. Return a list of temporary file pairs (tmpfile, destination path) and a list of arguments. Converts each HdfsTarget to a string for the path. """ tmp_files = [] args = [] for x in job.args()...
def fix_paths(job): """ Coerce input arguments to use temporary files when used for output. Return a list of temporary file pairs (tmpfile, destination path) and a list of arguments. Converts each HdfsTarget to a string for the path. """ tmp_files = [] args = [] for x in job.args()...
[ "Coerce", "input", "arguments", "to", "use", "temporary", "files", "when", "used", "for", "output", "." ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop_jar.py#L33-L62
[ "def", "fix_paths", "(", "job", ")", ":", "tmp_files", "=", "[", "]", "args", "=", "[", "]", "for", "x", "in", "job", ".", "args", "(", ")", ":", "if", "isinstance", "(", "x", ",", "luigi", ".", "contrib", ".", "hdfs", ".", "HdfsTarget", ")", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
BatchClient.get_active_queue
Get name of first active job queue
luigi/contrib/batch.py
def get_active_queue(self): """Get name of first active job queue""" # Get dict of active queues keyed by name queues = {q['jobQueueName']: q for q in self._client.describe_job_queues()['jobQueues'] if q['state'] == 'ENABLED' and q['status'] == 'VALID'} if not queues: ...
def get_active_queue(self): """Get name of first active job queue""" # Get dict of active queues keyed by name queues = {q['jobQueueName']: q for q in self._client.describe_job_queues()['jobQueues'] if q['state'] == 'ENABLED' and q['status'] == 'VALID'} if not queues: ...
[ "Get", "name", "of", "first", "active", "job", "queue" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L96-L106
[ "def", "get_active_queue", "(", "self", ")", ":", "# Get dict of active queues keyed by name", "queues", "=", "{", "q", "[", "'jobQueueName'", "]", ":", "q", "for", "q", "in", "self", ".", "_client", ".", "describe_job_queues", "(", ")", "[", "'jobQueues'", "]...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
BatchClient.get_job_id_from_name
Retrieve the first job ID matching the given name
luigi/contrib/batch.py
def get_job_id_from_name(self, job_name): """Retrieve the first job ID matching the given name""" jobs = self._client.list_jobs(jobQueue=self._queue, jobStatus='RUNNING')['jobSummaryList'] matching_jobs = [job for job in jobs if job['jobName'] == job_name] if matching_jobs: r...
def get_job_id_from_name(self, job_name): """Retrieve the first job ID matching the given name""" jobs = self._client.list_jobs(jobQueue=self._queue, jobStatus='RUNNING')['jobSummaryList'] matching_jobs = [job for job in jobs if job['jobName'] == job_name] if matching_jobs: r...
[ "Retrieve", "the", "first", "job", "ID", "matching", "the", "given", "name" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L108-L113
[ "def", "get_job_id_from_name", "(", "self", ",", "job_name", ")", ":", "jobs", "=", "self", ".", "_client", ".", "list_jobs", "(", "jobQueue", "=", "self", ".", "_queue", ",", "jobStatus", "=", "'RUNNING'", ")", "[", "'jobSummaryList'", "]", "matching_jobs",...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
BatchClient.get_job_status
Retrieve task statuses from ECS API :param job_id (str): AWS Batch job uuid Returns one of {SUBMITTED|PENDING|RUNNABLE|STARTING|RUNNING|SUCCEEDED|FAILED}
luigi/contrib/batch.py
def get_job_status(self, job_id): """Retrieve task statuses from ECS API :param job_id (str): AWS Batch job uuid Returns one of {SUBMITTED|PENDING|RUNNABLE|STARTING|RUNNING|SUCCEEDED|FAILED} """ response = self._client.describe_jobs(jobs=[job_id]) # Error checking ...
def get_job_status(self, job_id): """Retrieve task statuses from ECS API :param job_id (str): AWS Batch job uuid Returns one of {SUBMITTED|PENDING|RUNNABLE|STARTING|RUNNING|SUCCEEDED|FAILED} """ response = self._client.describe_jobs(jobs=[job_id]) # Error checking ...
[ "Retrieve", "task", "statuses", "from", "ECS", "API" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L115-L130
[ "def", "get_job_status", "(", "self", ",", "job_id", ")", ":", "response", "=", "self", ".", "_client", ".", "describe_jobs", "(", "jobs", "=", "[", "job_id", "]", ")", "# Error checking", "status_code", "=", "response", "[", "'ResponseMetadata'", "]", "[", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
BatchClient.get_logs
Retrieve log stream from CloudWatch
luigi/contrib/batch.py
def get_logs(self, log_stream_name, get_last=50): """Retrieve log stream from CloudWatch""" response = self._log_client.get_log_events( logGroupName='/aws/batch/job', logStreamName=log_stream_name, startFromHead=False) events = response['events'] retur...
def get_logs(self, log_stream_name, get_last=50): """Retrieve log stream from CloudWatch""" response = self._log_client.get_log_events( logGroupName='/aws/batch/job', logStreamName=log_stream_name, startFromHead=False) events = response['events'] retur...
[ "Retrieve", "log", "stream", "from", "CloudWatch" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L132-L139
[ "def", "get_logs", "(", "self", ",", "log_stream_name", ",", "get_last", "=", "50", ")", ":", "response", "=", "self", ".", "_log_client", ".", "get_log_events", "(", "logGroupName", "=", "'/aws/batch/job'", ",", "logStreamName", "=", "log_stream_name", ",", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
BatchClient.submit_job
Wrap submit_job with useful defaults
luigi/contrib/batch.py
def submit_job(self, job_definition, parameters, job_name=None, queue=None): """Wrap submit_job with useful defaults""" if job_name is None: job_name = _random_id() response = self._client.submit_job( jobName=job_name, jobQueue=queue or self.get_active_queue()...
def submit_job(self, job_definition, parameters, job_name=None, queue=None): """Wrap submit_job with useful defaults""" if job_name is None: job_name = _random_id() response = self._client.submit_job( jobName=job_name, jobQueue=queue or self.get_active_queue()...
[ "Wrap", "submit_job", "with", "useful", "defaults" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L141-L151
[ "def", "submit_job", "(", "self", ",", "job_definition", ",", "parameters", ",", "job_name", "=", "None", ",", "queue", "=", "None", ")", ":", "if", "job_name", "is", "None", ":", "job_name", "=", "_random_id", "(", ")", "response", "=", "self", ".", "...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
BatchClient.wait_on_job
Poll task status until STOPPED
luigi/contrib/batch.py
def wait_on_job(self, job_id): """Poll task status until STOPPED""" while True: status = self.get_job_status(job_id) if status == 'SUCCEEDED': logger.info('Batch job {} SUCCEEDED'.format(job_id)) return True elif status == 'FAILED': ...
def wait_on_job(self, job_id): """Poll task status until STOPPED""" while True: status = self.get_job_status(job_id) if status == 'SUCCEEDED': logger.info('Batch job {} SUCCEEDED'.format(job_id)) return True elif status == 'FAILED': ...
[ "Poll", "task", "status", "until", "STOPPED" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L153-L174
[ "def", "wait_on_job", "(", "self", ",", "job_id", ")", ":", "while", "True", ":", "status", "=", "self", ".", "get_job_status", "(", "job_id", ")", "if", "status", "==", "'SUCCEEDED'", ":", "logger", ".", "info", "(", "'Batch job {} SUCCEEDED'", ".", "form...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
train
BatchClient.register_job_definition
Register a job definition with AWS Batch, using a JSON
luigi/contrib/batch.py
def register_job_definition(self, json_fpath): """Register a job definition with AWS Batch, using a JSON""" with open(json_fpath) as f: job_def = json.load(f) response = self._client.register_job_definition(**job_def) status_code = response['ResponseMetadata']['HTTPStatusCode...
def register_job_definition(self, json_fpath): """Register a job definition with AWS Batch, using a JSON""" with open(json_fpath) as f: job_def = json.load(f) response = self._client.register_job_definition(**job_def) status_code = response['ResponseMetadata']['HTTPStatusCode...
[ "Register", "a", "job", "definition", "with", "AWS", "Batch", "using", "a", "JSON" ]
spotify/luigi
python
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L176-L185
[ "def", "register_job_definition", "(", "self", ",", "json_fpath", ")", ":", "with", "open", "(", "json_fpath", ")", "as", "f", ":", "job_def", "=", "json", ".", "load", "(", "f", ")", "response", "=", "self", ".", "_client", ".", "register_job_definition",...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9