id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
31,700
spotify/luigi
luigi/parameter.py
Parameter._get_value_from_config
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...
python
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", ")", ":", "conf", "=", "configuration", ".", "get_config", "(", ")", "try", ":", "value", "=", "conf", ".", "get", "(", "section", ",", "name", ")", "except", "(", "NoSectionError...
Loads the default from the config. Returns _no_value if it doesn't exist
[ "Loads", "the", "default", "from", "the", "config", ".", "Returns", "_no_value", "if", "it", "doesn", "t", "exist" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L192-L202
31,701
spotify/luigi
luigi/parameter.py
Parameter._value_iterator
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:...
python
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", ")", ":", "cp_parser", "=", "CmdlineParser", ".", "get_instance", "(", ")", "if", "cp_parser", ":", "dest", "=", "self", ".", "_parser_global_dest", "(", "param_name", ",", "task_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.
[ "Yield", "the", "parameter", "values", "with", "optional", "deprecation", "warning", "as", "second", "tuple", "value", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L212-L228
31,702
spotify/luigi
luigi/parameter.py
Parameter._parse_list
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...
python
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", ")", ":", "if", "not", "self", ".", "_is_batchable", "(", ")", ":", "raise", "NotImplementedError", "(", "'No batch method found'", ")", "elif", "not", "xs", ":", "raise", "ValueError", "(", "'Empty parameter 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...
[ "Parse", "a", "list", "of", "values", "from", "the", "scheduler", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L255-L270
31,703
spotify/luigi
luigi/parameter.py
_DateParameterBase.parse
def parse(self, s): """ Parses a date string formatted like ``YYYY-MM-DD``. """ return datetime.datetime.strptime(s, self.date_format).date()
python
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", ")", ":", "return", "datetime", ".", "datetime", ".", "strptime", "(", "s", ",", "self", ".", "date_format", ")", ".", "date", "(", ")" ]
Parses a date string formatted like ``YYYY-MM-DD``.
[ "Parses", "a", "date", "string", "formatted", "like", "YYYY", "-", "MM", "-", "DD", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L373-L377
31,704
spotify/luigi
luigi/parameter.py
MonthParameter._add_months
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. """ ...
python
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", ")", ":", "year", "=", "date", ".", "year", "+", "(", "date", ".", "month", "+", "months", "-", "1", ")", "//", "12", "month", "=", "(", "date", ".", "month", "+", "months", "-", "1...
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", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L447-L457
31,705
spotify/luigi
luigi/parameter.py
BoolParameter.parse
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...
python
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", ")", ":", "s", "=", "str", "(", "val", ")", ".", "lower", "(", ")", "if", "s", "==", "\"true\"", ":", "return", "True", "elif", "s", "==", "\"false\"", ":", "return", "False", "else", ":", "raise", "ValueE...
Parses a ``bool`` from the string, matching 'true' or 'false' ignoring case.
[ "Parses", "a", "bool", "from", "the", "string", "matching", "true", "or", "false", "ignoring", "case", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L686-L696
31,706
spotify/luigi
luigi/parameter.py
TimeDeltaParameter.parse
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: ...
python
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", ")", ":", "result", "=", "self", ".", "_parseIso8601", "(", "input", ")", "if", "not", "result", ":", "result", "=", "self", ".", "_parseSimple", "(", "input", ")", "if", "result", "is", "not", "None", ":", ...
Parses a time delta from the input. See :py:class:`TimeDeltaParameter` for details on supported formats.
[ "Parses", "a", "time", "delta", "from", "the", "input", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L790-L802
31,707
spotify/luigi
luigi/parameter.py
TimeDeltaParameter.serialize
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 ...
python
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", ")", ":", "weeks", "=", "x", ".", "days", "//", "7", "days", "=", "x", ".", "days", "%", "7", "hours", "=", "x", ".", "seconds", "//", "3600", "minutes", "=", "(", "x", ".", "seconds", "%", "3600", "...
Converts datetime.timedelta to a string :param x: the value to serialize.
[ "Converts", "datetime", ".", "timedelta", "to", "a", "string" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L804-L816
31,708
spotify/luigi
luigi/parameter.py
TupleParameter.parse
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...
python
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", ")", ":", "# 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...
Parse an individual value from the input. :param str x: the value to parse. :return: the parsed value.
[ "Parse", "an", "individual", "value", "from", "the", "input", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L1096-L1119
31,709
spotify/luigi
luigi/contrib/hadoop.py
create_packages_archive
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)...
python
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", ")", ":", "import", "tarfile", "tar", "=", "tarfile", ".", "open", "(", "filename", ",", "\"w\"", ")", "def", "add", "(", "src", ",", "dst", ")", ":", "logger", ".", "debug", "(", "'ad...
Create a tar archive which will contain the files for the packages listed in packages.
[ "Create", "a", "tar", "archive", "which", "will", "contain", "the", "files", "for", "the", "packages", "listed", "in", "packages", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L124-L194
31,710
spotify/luigi
luigi/contrib/hadoop.py
flatten
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): ...
python
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", ")", ":", "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. Only one level is flattened. .. code-block:: python (1, (2, 3), 4) -> (1, 2, 3, 4)
[ "A", "simple", "generator", "which", "flattens", "a", "sequence", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L197-L213
31,711
spotify/luigi
luigi/contrib/hadoop.py
fetch_task_failures
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...
python
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", ")", ":", "import", "mechanize", "timeout", "=", "3.0", "failures_url", "=", "tracking_url", ".", "replace", "(", "'jobdetails.jsp'", ",", "'jobfailures.jsp'", ")", "+", "'&cause=failed'", "logger", ".", "debug", ...
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....
[ "Uses", "mechanize", "to", "fetch", "the", "actual", "task", "logs", "from", "the", "task", "tracker", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L356-L391
31,712
spotify/luigi
luigi/contrib/hadoop.py
JobTask.job_runner
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...
python
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", "outputs", "=", "luigi", ".", "task", ".", "flatten", "(", "self", ".", "output", "(", ")", ")", "for", "output", "in", "outputs",...
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).
[ "Get", "the", "MapReduce", "runner", "for", "this", "job", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L813-L829
31,713
spotify/luigi
luigi/contrib/hadoop.py
JobTask.writer
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: ...
python
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", ")", ":", "for", "output", "in", "outputs", ":", "try", ":", "output", "=", "flatten", "(", "output", ")", "if", "self", ".", "data_interchange_forma...
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.
[ "Writer", "format", "is", "a", "method", "which", "iterates", "over", "the", "output", "records", "from", "the", "reducer", "and", "formats", "them", "for", "output", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L839-L858
31,714
spotify/luigi
luigi/contrib/hadoop.py
JobTask._flush_batch_incr_counter
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...
python
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", ")", ":", "for", "key", ",", "count", "in", "six", ".", "iteritems", "(", "self", ".", "_counter_dict", ")", ":", "if", "count", "==", "0", ":", "continue", "args", "=", "list", "(", "key", ")", "+", "...
Increments any unflushed counter values.
[ "Increments", "any", "unflushed", "counter", "values", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L893-L902
31,715
spotify/luigi
luigi/contrib/hadoop.py
JobTask._map_input
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...
python
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", ")", ":", "for", "record", "in", "self", ".", "reader", "(", "input_stream", ")", ":", "for", "output", "in", "self", ".", "mapper", "(", "*", "record", ")", ":", "yield", "output", "if", "self", ...
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.
[ "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...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L989-L1004
31,716
spotify/luigi
luigi/contrib/hadoop.py
JobTask._reduce_input
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....
python
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", ")", ":", "for", "key", ",", "values", "in", "groupby", "(", "inputs", ",", "key", "=", "lambda", "x", ":", "self", ".", "internal_serialize", "(", ...
Iterate over input, collect values with the same key, and call the reducer for each unique key.
[ "Iterate", "over", "input", "collect", "values", "with", "the", "same", "key", "and", "call", "the", "reducer", "for", "each", "unique", "key", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1006-L1016
31,717
spotify/luigi
luigi/contrib/hadoop.py
JobTask.run_mapper
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, ...
python
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", ")", ":", "self", ".", "init_hadoop", "(", ")", "self", ".", "init_mapper", "(", ")", "outputs", "=", "self", ".", "_map_input", "(", ...
Run the mapper on the hadoop node.
[ "Run", "the", "mapper", "on", "the", "hadoop", "node", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1018-L1028
31,718
spotify/luigi
luigi/contrib/hadoop.py
JobTask.run_reducer
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...
python
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", ")", ":", "self", ".", "init_hadoop", "(", ")", "self", ".", "init_reducer", "(", ")", "outputs", "=", "self", ".", "_reduce_input", ...
Run the reducer on the hadoop node.
[ "Run", "the", "reducer", "on", "the", "hadoop", "node", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1030-L1037
31,719
spotify/luigi
luigi/contrib/hadoop.py
JobTask.internal_reader
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")))
python
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", ")", ":", "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.
[ "Reader", "which", "uses", "python", "eval", "on", "each", "part", "of", "a", "tab", "separated", "string", ".", "Yields", "a", "tuple", "of", "python", "objects", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1045-L1051
31,720
spotify/luigi
luigi/contrib/hadoop.py
JobTask.internal_writer
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)
python
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", ")", ":", "for", "output", "in", "outputs", ":", "print", "(", "\"\\t\"", ".", "join", "(", "map", "(", "self", ".", "internal_serialize", ",", "output", ")", ")", ",", "file", "=", ...
Writer which outputs the python repr for each item.
[ "Writer", "which", "outputs", "the", "python", "repr", "for", "each", "item", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1053-L1058
31,721
spotify/luigi
luigi/contrib/postgres.py
PostgresTarget.connect
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) ...
python
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", ")", ":", "connection", "=", "psycopg2", ".", "connect", "(", "host", "=", "self", ".", "host", ",", "port", "=", "self", ".", "port", ",", "database", "=", "self", ".", "database", ",", "user", "=", "self", ".", "use...
Get a psycopg2 connection object to the database where the table is.
[ "Get", "a", "psycopg2", "connection", "object", "to", "the", "database", "where", "the", "table", "is", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L187-L198
31,722
spotify/luigi
luigi/contrib/postgres.py
CopyToTable.map_column
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...
python
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", ")", ":", "if", "value", "in", "self", ".", "null_values", ":", "return", "r'\\\\N'", "else", ":", "return", "default_escape", "(", "six", ".", "text_type", "(", "value", ")", ")" ]
Applied to each column of every row returned by `rows`. Default behaviour is to escape special characters and identify any self.null_values.
[ "Applied", "to", "each", "column", "of", "every", "row", "returned", "by", "rows", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L255-L264
31,723
spotify/luigi
luigi/contrib/postgres.py
CopyToTable.output
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, ...
python
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", ")", ":", "return", "PostgresTarget", "(", "host", "=", "self", ".", "host", ",", "database", "=", "self", ".", "database", ",", "user", "=", "self", ".", "user", ",", "password", "=", "self", ".", "password", ",", "tabl...
Returns a PostgresTarget representing the inserted dataset. Normally you don't override this.
[ "Returns", "a", "PostgresTarget", "representing", "the", "inserted", "dataset", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L268-L282
31,724
spotify/luigi
luigi/configuration/core.py
get_config
def get_config(parser=PARSER): """Get configs singleton for parser """ parser_class = PARSERS[parser] _check_parser(parser_class, parser) return parser_class.instance()
python
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", ")", ":", "parser_class", "=", "PARSERS", "[", "parser", "]", "_check_parser", "(", "parser_class", ",", "parser", ")", "return", "parser_class", ".", "instance", "(", ")" ]
Get configs singleton for parser
[ "Get", "configs", "singleton", "for", "parser" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/configuration/core.py#L53-L58
31,725
spotify/luigi
luigi/configuration/core.py
add_config_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) ...
python
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", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "warnings", ".", "warn", "(", "\"Config file does not exist: {path}\"", ".", "format", "(", "path", "=", "path", ")", ")", "return", "F...
Select config parser by file extension and add path into parser.
[ "Select", "config", "parser", "by", "file", "extension", "and", "add", "path", "into", "parser", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/configuration/core.py#L61-L87
31,726
spotify/luigi
luigi/contrib/spark.py
PySparkTask._setup_packages
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: ...
python
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", ")", ":", "packages", "=", "self", ".", "py_packages", "if", "not", "packages", ":", "return", "for", "package", "in", "packages", ":", "mod", "=", "importlib", ".", "import_module", "(", "package", ")", ...
This method compresses and uploads packages to the cluster
[ "This", "method", "compresses", "and", "uploads", "packages", "to", "the", "cluster" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/spark.py#L323-L341
31,727
spotify/luigi
luigi/contrib/mrrunner.py
main
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. ...
python
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", ")", ":", "try", ":", "# Set up logging.", "logging", ".", "basicConfig", "(", "lev...
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
[ "Run", "either", "the", "mapper", "combiner", "or", "reducer", "from", "the", "class", "instance", "in", "the", "file", "job", "-", "instance", ".", "pickle", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mrrunner.py#L80-L97
31,728
spotify/luigi
luigi/retcodes.py
run_with_retcodes
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...
python
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", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "'luigi-interface'", ")", "with", "luigi", ".", "cmdline_parser", ".", "CmdlineParser", ".", "global_instance", "(", "argv", ")", ":", "retcodes", "=", "retcode...
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:]``
[ "Run", "luigi", "with", "command", "line", "parsing", "but", "raise", "SystemExit", "with", "the", "configured", "exit", "code", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/retcodes.py#L61-L108
31,729
spotify/luigi
luigi/tools/deps.py
find_deps_cli
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)
python
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", "(", ")", ":", "cmdline_args", "=", "sys", ".", "argv", "[", "1", ":", "]", "with", "CmdlineParser", ".", "global_instance", "(", "cmdline_args", ")", "as", "cp", ":", "return", "find_deps", "(", "cp", ".", "get_task_obj", "(", ")...
Finds all tasks on all paths from provided CLI task
[ "Finds", "all", "tasks", "on", "all", "paths", "from", "provided", "CLI", "task" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/deps.py#L85-L91
31,730
spotify/luigi
luigi/tools/deps.py
get_task_output_description
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, ...
python
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", ")", ":", "output_description", "=", "\"n/a\"", "if", "isinstance", "(", "task_output", ",", "RemoteTarget", ")", ":", "output_description", "=", "\"[SSH] {0}:{1}\"", ".", "format", "(", "task_output", ".", "...
Returns a task's output as a string
[ "Returns", "a", "task", "s", "output", "as", "a", "string" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/deps.py#L94-L111
31,731
spotify/luigi
luigi/tools/range.py
_constrain_glob
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...
python
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", ")", ":", "def", "digit_set_wildcard", "(", "chars", ")", ":", "\"\"\"\n Makes a wildcard expression for the set, a bit readable, e.g. [1-5].\n \"\"\"", "chars", "=", "sorted", "(",...
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...
[ "Tweaks", "glob", "into", "a", "list", "of", "more", "specific", "globs", "that", "together", "still", "cover", "paths", "and", "not", "too", "much", "extra", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L491-L528
31,732
spotify/luigi
luigi/tools/range.py
_get_per_location_glob
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 ...
python
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", ")", ":", "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...
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.
[ "Builds", "a", "glob", "listing", "existing", "output", "paths", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L542-L570
31,733
spotify/luigi
luigi/tools/range.py
_list_existing
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 ...
python
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", ")", ":", "globs", "=", "_constrain_glob", "(", "glob", ",", "paths", ")", "time_start", "=", "time", ".", "time", "(", ")", "listing", "=", "[", "]", "for", "g", "in", "sorted", ...
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.
[ "Get", "all", "the", "paths", "that", "do", "in", "fact", "exist", ".", "Returns", "a", "set", "of", "all", "existing", "paths", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L603-L619
31,734
spotify/luigi
luigi/tools/range.py
infer_bulk_complete_from_fs
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...
python
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", ")", ":", "filesystems_and_globs_by_location", "=", "_get_filesystems_and_globs", "(", "datetime_to_task", ",", "datetime_to_re", ")", "paths_by_datetime", "=", "[", "[",...
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...
[ "Efficiently", "determines", "missing", "datetimes", "by", "filesystem", "listing", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L622-L647
31,735
spotify/luigi
luigi/tools/range.py
RangeBase.of_cls
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
python
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", ")", ":", "if", "isinstance", "(", "self", ".", "of", ",", "six", ".", "string_types", ")", ":", "warnings", ".", "warn", "(", "'When using Range programatically, dont pass \"of\" param as string!'", ")", "return", "Register", ".", ...
DONT USE. Will be deleted soon. Use ``self.of``!
[ "DONT", "USE", ".", "Will", "be", "deleted", "soon", ".", "Use", "self", ".", "of", "!" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L117-L124
31,736
spotify/luigi
luigi/tools/range.py
RangeBase.missing_datetimes
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 ...
python
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", ")", ":", "return", "[", "d", "for", "d", "in", "finite_datetimes", "if", "not", "self", ".", "_instantiate_task_cls", "(", "self", ".", "datetime_to_parameter", "(", "d", ")", ")", ".", "comp...
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.
[ "Override", "in", "subclasses", "to", "do", "bulk", "checks", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L255-L265
31,737
spotify/luigi
luigi/tools/range.py
RangeDailyBase.parameters_to_datetime
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)
python
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", ")", ":", "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
[ "Given", "a", "dictionary", "of", "parameters", "will", "extract", "the", "ranged", "task", "parameter", "value" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L316-L321
31,738
spotify/luigi
luigi/tools/range.py
RangeDailyBase.finite_datetimes
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...
python
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", ")", ":", "date_start", "=", "datetime", "(", "finite_start", ".", "year", ",", "finite_start", ".", "month", ",", "finite_start", ".", "day", ")", "dates", "=", "[", "]", "fo...
Simply returns the points in time that correspond to turn of day.
[ "Simply", "returns", "the", "points", "in", "time", "that", "correspond", "to", "turn", "of", "day", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L329-L340
31,739
spotify/luigi
luigi/tools/range.py
RangeHourlyBase.finite_datetimes
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()...
python
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", ")", ":", "datehour_start", "=", "datetime", "(", "finite_start", ".", "year", ",", "finite_start", ".", "month", ",", "finite_start", ".", "day", ",", "finite_start", ".", "hour"...
Simply returns the points in time that correspond to whole hours.
[ "Simply", "returns", "the", "points", "in", "time", "that", "correspond", "to", "whole", "hours", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L391-L402
31,740
spotify/luigi
luigi/tools/range.py
RangeByMinutesBase.finite_datetimes
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...
python
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", ")", ":", "# 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", ")", ":", ...
Simply returns the points in time that correspond to a whole number of minutes intervals.
[ "Simply", "returns", "the", "points", "in", "time", "that", "correspond", "to", "a", "whole", "number", "of", "minutes", "intervals", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L462-L485
31,741
spotify/luigi
luigi/tools/range.py
RangeMonthly.finite_datetimes
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 =...
python
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", ")", ":", "start_date", "=", "self", ".", "_align", "(", "finite_start", ")", "aligned_stop", "=", "self", ".", "_align", "(", "finite_stop", ")", "dates", "=", "[", "]", "for...
Simply returns the points in time that correspond to turn of month.
[ "Simply", "returns", "the", "points", "in", "time", "that", "correspond", "to", "turn", "of", "month", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L709-L721
31,742
spotify/luigi
luigi/contrib/mssqldb.py
MSSqlTarget.connect
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=...
python
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", ")", ":", "connection", "=", "_mssql", ".", "connect", "(", "user", "=", "self", ".", "user", ",", "password", "=", "self", ".", "password", ",", "server", "=", "self", ".", "host", ",", "port", "=", "self", ".", "por...
Create a SQL Server connection and return a connection object
[ "Create", "a", "SQL", "Server", "connection", "and", "return", "a", "connection", "object" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mssqldb.py#L119-L128
31,743
spotify/luigi
luigi/contrib/opener.py
OpenerRegistry.get_opener
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...
python
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", ")", ":", "if", "name", "not", "in", "self", ".", "registry", ":", "raise", "NoOpenerError", "(", "\"No opener for %s\"", "%", "name", ")", "index", "=", "self", ".", "registry", "[", "name", "]", "return", ...
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
[ "Retrieve", "an", "opener", "for", "the", "given", "protocol" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/opener.py#L89-L100
31,744
spotify/luigi
luigi/contrib/opener.py
OpenerRegistry.add
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
python
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", ")", ":", "index", "=", "len", "(", "self", ".", "openers", ")", "self", ".", "openers", "[", "index", "]", "=", "opener", "for", "name", "in", "opener", ".", "names", ":", "self", ".", "registry", "[", "...
Adds an opener to the registry :param opener: Opener object :type opener: Opener inherited object
[ "Adds", "an", "opener", "to", "the", "registry" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/opener.py#L102-L113
31,745
spotify/luigi
luigi/contrib/opener.py
OpenerRegistry.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...
python
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", ")", ":", "target", "=", "urlsplit", "(", "target_uri", ",", "scheme", "=", "self", ".", "default_opener", ")", "opener", "=", "self", ".", "get_opener", "(", "target", ".", "schem...
Open target uri. :param target_uri: Uri to open :type target_uri: string :returns: Target object
[ "Open", "target", "uri", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/opener.py#L115-L142
31,746
spotify/luigi
luigi/contrib/opener.py
Opener.conform_query
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...
python
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", ")", ":", "query", "=", "parse_qs", "(", "query", ",", "keep_blank_values", "=", "True", ")", "# Remove any unexpected keywords from the query string.", "if", "cls", ".", "filter_kwargs", ":", "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...
[ "Converts", "the", "query", "string", "from", "a", "target", "uri", "uses", "cls", ".", "allowed_kwargs", "and", "cls", ".", "filter_kwargs", "to", "drive", "logic", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/opener.py#L157-L183
31,747
spotify/luigi
luigi/interface.py
run
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...
python
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", ")", ":", "luigi_run_result", "=", "_run", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "luigi_run_result", "if", "kwargs", ".", "get", "(", "'detailed_summary'", ")", "else", "luigi...
Please dont use. Instead use `luigi` binary. Run from cmdline using argparse. :param use_dynamic_argparse: Deprecated and ignored
[ "Please", "dont", "use", ".", "Instead", "use", "luigi", "binary", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/interface.py#L186-L195
31,748
spotify/luigi
luigi/interface.py
build
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...
python
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", ")", ":", "if", "\"no_lock\"", "not", "in", "env_params", ":", "env_params", "[", "\"no_lock\"", "]", "=", "True",...
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 ...
[ "Run", "internally", "bypassing", "the", "cmdline", "parsing", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/interface.py#L214-L238
31,749
spotify/luigi
luigi/contrib/hadoop_jar.py
fix_paths
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()...
python
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", ")", ":", "tmp_files", "=", "[", "]", "args", "=", "[", "]", "for", "x", "in", "job", ".", "args", "(", ")", ":", "if", "isinstance", "(", "x", ",", "luigi", ".", "contrib", ".", "hdfs", ".", "HdfsTarget", ")", "...
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.
[ "Coerce", "input", "arguments", "to", "use", "temporary", "files", "when", "used", "for", "output", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop_jar.py#L33-L62
31,750
spotify/luigi
luigi/contrib/batch.py
BatchClient.get_active_queue
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: ...
python
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 dict of active queues keyed by name", "queues", "=", "{", "q", "[", "'jobQueueName'", "]", ":", "q", "for", "q", "in", "self", ".", "_client", ".", "describe_job_queues", "(", ")", "[", "'jobQueues'", "]...
Get name of first active job queue
[ "Get", "name", "of", "first", "active", "job", "queue" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L96-L106
31,751
spotify/luigi
luigi/contrib/batch.py
BatchClient.get_job_id_from_name
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...
python
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", ")", ":", "jobs", "=", "self", ".", "_client", ".", "list_jobs", "(", "jobQueue", "=", "self", ".", "_queue", ",", "jobStatus", "=", "'RUNNING'", ")", "[", "'jobSummaryList'", "]", "matching_jobs",...
Retrieve the first job ID matching the given name
[ "Retrieve", "the", "first", "job", "ID", "matching", "the", "given", "name" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L108-L113
31,752
spotify/luigi
luigi/contrib/batch.py
BatchClient.get_logs
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...
python
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", ")", ":", "response", "=", "self", ".", "_log_client", ".", "get_log_events", "(", "logGroupName", "=", "'/aws/batch/job'", ",", "logStreamName", "=", "log_stream_name", ",", "...
Retrieve log stream from CloudWatch
[ "Retrieve", "log", "stream", "from", "CloudWatch" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L132-L139
31,753
spotify/luigi
luigi/contrib/batch.py
BatchClient.submit_job
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()...
python
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", ")", ":", "if", "job_name", "is", "None", ":", "job_name", "=", "_random_id", "(", ")", "response", "=", "self", ".", "...
Wrap submit_job with useful defaults
[ "Wrap", "submit_job", "with", "useful", "defaults" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L141-L151
31,754
spotify/luigi
luigi/contrib/batch.py
BatchClient.register_job_definition
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...
python
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", ")", ":", "with", "open", "(", "json_fpath", ")", "as", "f", ":", "job_def", "=", "json", ".", "load", "(", "f", ")", "response", "=", "self", ".", "_client", ".", "register_job_definition",...
Register a job definition with AWS Batch, using a JSON
[ "Register", "a", "job", "definition", "with", "AWS", "Batch", "using", "a", "JSON" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L176-L185
31,755
spotify/luigi
luigi/contrib/bigquery_avro.py
BigQueryLoadAvro._get_input_schema
def _get_input_schema(self): """Arbitrarily picks an object in input and reads the Avro schema from it.""" assert avro, 'avro module required' input_target = flatten(self.input())[0] input_fs = input_target.fs if hasattr(input_target, 'fs') else GCSClient() input_uri = self.sour...
python
def _get_input_schema(self): """Arbitrarily picks an object in input and reads the Avro schema from it.""" assert avro, 'avro module required' input_target = flatten(self.input())[0] input_fs = input_target.fs if hasattr(input_target, 'fs') else GCSClient() input_uri = self.sour...
[ "def", "_get_input_schema", "(", "self", ")", ":", "assert", "avro", ",", "'avro module required'", "input_target", "=", "flatten", "(", "self", ".", "input", "(", ")", ")", "[", "0", "]", "input_fs", "=", "input_target", ".", "fs", "if", "hasattr", "(", ...
Arbitrarily picks an object in input and reads the Avro schema from it.
[ "Arbitrarily", "picks", "an", "object", "in", "input", "and", "reads", "the", "Avro", "schema", "from", "it", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery_avro.py#L40-L75
31,756
spotify/luigi
luigi/contrib/bigquery.py
BigQueryClient.table_exists
def table_exists(self, table): """Returns whether the given table exists. :param table: :type table: BQTable """ if not self.dataset_exists(table.dataset): return False try: self.client.tables().get(projectId=table.project_id, ...
python
def table_exists(self, table): """Returns whether the given table exists. :param table: :type table: BQTable """ if not self.dataset_exists(table.dataset): return False try: self.client.tables().get(projectId=table.project_id, ...
[ "def", "table_exists", "(", "self", ",", "table", ")", ":", "if", "not", "self", ".", "dataset_exists", "(", "table", ".", "dataset", ")", ":", "return", "False", "try", ":", "self", ".", "client", ".", "tables", "(", ")", ".", "get", "(", "projectId...
Returns whether the given table exists. :param table: :type table: BQTable
[ "Returns", "whether", "the", "given", "table", "exists", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L157-L175
31,757
spotify/luigi
luigi/contrib/bigquery.py
BigQueryClient.make_dataset
def make_dataset(self, dataset, raise_if_exists=False, body=None): """Creates a new dataset with the default permissions. :param dataset: :type dataset: BQDataset :param raise_if_exists: whether to raise an exception if the dataset already exists. :raises luigi.targe...
python
def make_dataset(self, dataset, raise_if_exists=False, body=None): """Creates a new dataset with the default permissions. :param dataset: :type dataset: BQDataset :param raise_if_exists: whether to raise an exception if the dataset already exists. :raises luigi.targe...
[ "def", "make_dataset", "(", "self", ",", "dataset", ",", "raise_if_exists", "=", "False", ",", "body", "=", "None", ")", ":", "if", "body", "is", "None", ":", "body", "=", "{", "}", "try", ":", "# Construct a message body in the format required by", "# https:/...
Creates a new dataset with the default permissions. :param dataset: :type dataset: BQDataset :param raise_if_exists: whether to raise an exception if the dataset already exists. :raises luigi.target.FileAlreadyExists: if raise_if_exists=True and the dataset exists
[ "Creates", "a", "new", "dataset", "with", "the", "default", "permissions", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L177-L204
31,758
spotify/luigi
luigi/contrib/bigquery.py
BigQueryClient.delete_table
def delete_table(self, table): """Deletes a table, if it exists. :param table: :type table: BQTable """ if not self.table_exists(table): return self.client.tables().delete(projectId=table.project_id, datasetId=table...
python
def delete_table(self, table): """Deletes a table, if it exists. :param table: :type table: BQTable """ if not self.table_exists(table): return self.client.tables().delete(projectId=table.project_id, datasetId=table...
[ "def", "delete_table", "(", "self", ",", "table", ")", ":", "if", "not", "self", ".", "table_exists", "(", "table", ")", ":", "return", "self", ".", "client", ".", "tables", "(", ")", ".", "delete", "(", "projectId", "=", "table", ".", "project_id", ...
Deletes a table, if it exists. :param table: :type table: BQTable
[ "Deletes", "a", "table", "if", "it", "exists", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L221-L233
31,759
spotify/luigi
luigi/contrib/bigquery.py
BigQueryClient.list_datasets
def list_datasets(self, project_id): """Returns the list of datasets in a given project. :param project_id: :type project_id: str """ request = self.client.datasets().list(projectId=project_id, maxResults=1000) respons...
python
def list_datasets(self, project_id): """Returns the list of datasets in a given project. :param project_id: :type project_id: str """ request = self.client.datasets().list(projectId=project_id, maxResults=1000) respons...
[ "def", "list_datasets", "(", "self", ",", "project_id", ")", ":", "request", "=", "self", ".", "client", ".", "datasets", "(", ")", ".", "list", "(", "projectId", "=", "project_id", ",", "maxResults", "=", "1000", ")", "response", "=", "request", ".", ...
Returns the list of datasets in a given project. :param project_id: :type project_id: str
[ "Returns", "the", "list", "of", "datasets", "in", "a", "given", "project", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L235-L254
31,760
spotify/luigi
luigi/contrib/bigquery.py
BigQueryClient.list_tables
def list_tables(self, dataset): """Returns the list of tables in a given dataset. :param dataset: :type dataset: BQDataset """ request = self.client.tables().list(projectId=dataset.project_id, datasetId=dataset.dataset_id, ...
python
def list_tables(self, dataset): """Returns the list of tables in a given dataset. :param dataset: :type dataset: BQDataset """ request = self.client.tables().list(projectId=dataset.project_id, datasetId=dataset.dataset_id, ...
[ "def", "list_tables", "(", "self", ",", "dataset", ")", ":", "request", "=", "self", ".", "client", ".", "tables", "(", ")", ".", "list", "(", "projectId", "=", "dataset", ".", "project_id", ",", "datasetId", "=", "dataset", ".", "dataset_id", ",", "ma...
Returns the list of tables in a given dataset. :param dataset: :type dataset: BQDataset
[ "Returns", "the", "list", "of", "tables", "in", "a", "given", "dataset", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L256-L276
31,761
spotify/luigi
luigi/contrib/bigquery.py
BigQueryClient.get_view
def get_view(self, table): """Returns the SQL query for a view, or None if it doesn't exist or is not a view. :param table: The table containing the view. :type table: BQTable """ request = self.client.tables().get(projectId=table.project_id, ...
python
def get_view(self, table): """Returns the SQL query for a view, or None if it doesn't exist or is not a view. :param table: The table containing the view. :type table: BQTable """ request = self.client.tables().get(projectId=table.project_id, ...
[ "def", "get_view", "(", "self", ",", "table", ")", ":", "request", "=", "self", ".", "client", ".", "tables", "(", ")", ".", "get", "(", "projectId", "=", "table", ".", "project_id", ",", "datasetId", "=", "table", ".", "dataset_id", ",", "tableId", ...
Returns the SQL query for a view, or None if it doesn't exist or is not a view. :param table: The table containing the view. :type table: BQTable
[ "Returns", "the", "SQL", "query", "for", "a", "view", "or", "None", "if", "it", "doesn", "t", "exist", "or", "is", "not", "a", "view", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L278-L296
31,762
spotify/luigi
luigi/contrib/bigquery.py
BigQueryClient.update_view
def update_view(self, table, view): """Updates the SQL query for a view. If the output table exists, it is replaced with the supplied view query. Otherwise a new table is created with this view. :param table: The table to contain the view. :type table: BQTable :param vi...
python
def update_view(self, table, view): """Updates the SQL query for a view. If the output table exists, it is replaced with the supplied view query. Otherwise a new table is created with this view. :param table: The table to contain the view. :type table: BQTable :param vi...
[ "def", "update_view", "(", "self", ",", "table", ",", "view", ")", ":", "body", "=", "{", "'tableReference'", ":", "{", "'projectId'", ":", "table", ".", "project_id", ",", "'datasetId'", ":", "table", ".", "dataset_id", ",", "'tableId'", ":", "table", "...
Updates the SQL query for a view. If the output table exists, it is replaced with the supplied view query. Otherwise a new table is created with this view. :param table: The table to contain the view. :type table: BQTable :param view: The SQL query for the view. :type v...
[ "Updates", "the", "SQL", "query", "for", "a", "view", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L298-L329
31,763
spotify/luigi
luigi/contrib/bigquery.py
BigQueryClient.run_job
def run_job(self, project_id, body, dataset=None): """Runs a BigQuery "job". See the documentation for the format of body. .. note:: You probably don't need to use this directly. Use the tasks defined below. :param dataset: :type dataset: BQDataset """ ...
python
def run_job(self, project_id, body, dataset=None): """Runs a BigQuery "job". See the documentation for the format of body. .. note:: You probably don't need to use this directly. Use the tasks defined below. :param dataset: :type dataset: BQDataset """ ...
[ "def", "run_job", "(", "self", ",", "project_id", ",", "body", ",", "dataset", "=", "None", ")", ":", "if", "dataset", "and", "not", "self", ".", "dataset_exists", "(", "dataset", ")", ":", "self", ".", "make_dataset", "(", "dataset", ")", "new_job", "...
Runs a BigQuery "job". See the documentation for the format of body. .. note:: You probably don't need to use this directly. Use the tasks defined below. :param dataset: :type dataset: BQDataset
[ "Runs", "a", "BigQuery", "job", ".", "See", "the", "documentation", "for", "the", "format", "of", "body", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L331-L355
31,764
spotify/luigi
luigi/contrib/bigquery.py
BigQueryLoadTask.source_uris
def source_uris(self): """The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.""" return [x.path for x in luigi.task.flatten(self.input())]
python
def source_uris(self): """The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.""" return [x.path for x in luigi.task.flatten(self.input())]
[ "def", "source_uris", "(", "self", ")", ":", "return", "[", "x", ".", "path", "for", "x", "in", "luigi", ".", "task", ".", "flatten", "(", "self", ".", "input", "(", ")", ")", "]" ]
The fully-qualified URIs that point to your data in Google Cloud Storage. Each URI can contain one '*' wildcard character and it must come after the 'bucket' name.
[ "The", "fully", "-", "qualified", "URIs", "that", "point", "to", "your", "data", "in", "Google", "Cloud", "Storage", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L487-L491
31,765
spotify/luigi
luigi/contrib/ssh.py
RemoteContext.Popen
def Popen(self, cmd, **kwargs): """ Remote Popen. """ prefixed_cmd = self._prepare_cmd(cmd) return subprocess.Popen(prefixed_cmd, **kwargs)
python
def Popen(self, cmd, **kwargs): """ Remote Popen. """ prefixed_cmd = self._prepare_cmd(cmd) return subprocess.Popen(prefixed_cmd, **kwargs)
[ "def", "Popen", "(", "self", ",", "cmd", ",", "*", "*", "kwargs", ")", ":", "prefixed_cmd", "=", "self", ".", "_prepare_cmd", "(", "cmd", ")", "return", "subprocess", ".", "Popen", "(", "prefixed_cmd", ",", "*", "*", "kwargs", ")" ]
Remote Popen.
[ "Remote", "Popen", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/ssh.py#L116-L121
31,766
spotify/luigi
luigi/contrib/ssh.py
RemoteContext.check_output
def check_output(self, cmd): """ Execute a shell command remotely and return the output. Simplified version of Popen when you only want the output as a string and detect any errors. """ p = self.Popen(cmd, stdout=subprocess.PIPE) output, _ = p.communicate() if p....
python
def check_output(self, cmd): """ Execute a shell command remotely and return the output. Simplified version of Popen when you only want the output as a string and detect any errors. """ p = self.Popen(cmd, stdout=subprocess.PIPE) output, _ = p.communicate() if p....
[ "def", "check_output", "(", "self", ",", "cmd", ")", ":", "p", "=", "self", ".", "Popen", "(", "cmd", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", "output", ",", "_", "=", "p", ".", "communicate", "(", ")", "if", "p", ".", "returncode", "!...
Execute a shell command remotely and return the output. Simplified version of Popen when you only want the output as a string and detect any errors.
[ "Execute", "a", "shell", "command", "remotely", "and", "return", "the", "output", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/ssh.py#L123-L133
31,767
spotify/luigi
luigi/contrib/ssh.py
RemoteFileSystem.isdir
def isdir(self, path): """ Return `True` if directory at `path` exist, False otherwise. """ try: self.remote_context.check_output(["test", "-d", path]) except subprocess.CalledProcessError as e: if e.returncode == 1: return False ...
python
def isdir(self, path): """ Return `True` if directory at `path` exist, False otherwise. """ try: self.remote_context.check_output(["test", "-d", path]) except subprocess.CalledProcessError as e: if e.returncode == 1: return False ...
[ "def", "isdir", "(", "self", ",", "path", ")", ":", "try", ":", "self", ".", "remote_context", ".", "check_output", "(", "[", "\"test\"", ",", "\"-d\"", ",", "path", "]", ")", "except", "subprocess", ".", "CalledProcessError", "as", "e", ":", "if", "e"...
Return `True` if directory at `path` exist, False otherwise.
[ "Return", "True", "if", "directory", "at", "path", "exist", "False", "otherwise", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/ssh.py#L184-L195
31,768
spotify/luigi
luigi/lock.py
getpcmd
def getpcmd(pid): """ Returns command of process. :param pid: """ if os.name == "nt": # Use wmic command instead of ps on Windows. cmd = 'wmic path win32_process where ProcessID=%s get Commandline 2> nul' % (pid, ) with os.popen(cmd, 'r') as p: lines = [line for ...
python
def getpcmd(pid): """ Returns command of process. :param pid: """ if os.name == "nt": # Use wmic command instead of ps on Windows. cmd = 'wmic path win32_process where ProcessID=%s get Commandline 2> nul' % (pid, ) with os.popen(cmd, 'r') as p: lines = [line for ...
[ "def", "getpcmd", "(", "pid", ")", ":", "if", "os", ".", "name", "==", "\"nt\"", ":", "# Use wmic command instead of ps on Windows.", "cmd", "=", "'wmic path win32_process where ProcessID=%s get Commandline 2> nul'", "%", "(", "pid", ",", ")", "with", "os", ".", "po...
Returns command of process. :param pid:
[ "Returns", "command", "of", "process", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/lock.py#L33-L79
31,769
spotify/luigi
luigi/lock.py
acquire_for
def acquire_for(pid_dir, num_available=1, kill_signal=None): """ Makes sure the process is only run once at the same time with the same name. Notice that we since we check the process name, different parameters to the same command can spawn multiple processes at the same time, i.e. running "/usr/bi...
python
def acquire_for(pid_dir, num_available=1, kill_signal=None): """ Makes sure the process is only run once at the same time with the same name. Notice that we since we check the process name, different parameters to the same command can spawn multiple processes at the same time, i.e. running "/usr/bi...
[ "def", "acquire_for", "(", "pid_dir", ",", "num_available", "=", "1", ",", "kill_signal", "=", "None", ")", ":", "my_pid", ",", "my_cmd", ",", "pid_file", "=", "get_info", "(", "pid_dir", ")", "# Create a pid file if it does not exist", "try", ":", "os", ".", ...
Makes sure the process is only run once at the same time with the same name. Notice that we since we check the process name, different parameters to the same command can spawn multiple processes at the same time, i.e. running "/usr/bin/my_process" does not prevent anyone from launching "/usr/bin/my_pro...
[ "Makes", "sure", "the", "process", "is", "only", "run", "once", "at", "the", "same", "time", "with", "the", "same", "name", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/lock.py#L94-L138
31,770
spotify/luigi
luigi/scheduler.py
Failures.add_failure
def add_failure(self): """ Add a failure event with the current timestamp. """ failure_time = time.time() if not self.first_failure_time: self.first_failure_time = failure_time self.failures.append(failure_time)
python
def add_failure(self): """ Add a failure event with the current timestamp. """ failure_time = time.time() if not self.first_failure_time: self.first_failure_time = failure_time self.failures.append(failure_time)
[ "def", "add_failure", "(", "self", ")", ":", "failure_time", "=", "time", ".", "time", "(", ")", "if", "not", "self", ".", "first_failure_time", ":", "self", ".", "first_failure_time", "=", "failure_time", "self", ".", "failures", ".", "append", "(", "fail...
Add a failure event with the current timestamp.
[ "Add", "a", "failure", "event", "with", "the", "current", "timestamp", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/scheduler.py#L179-L188
31,771
spotify/luigi
luigi/scheduler.py
Failures.num_failures
def num_failures(self): """ Return the number of failures in the window. """ min_time = time.time() - self.window while self.failures and self.failures[0] < min_time: self.failures.popleft() return len(self.failures)
python
def num_failures(self): """ Return the number of failures in the window. """ min_time = time.time() - self.window while self.failures and self.failures[0] < min_time: self.failures.popleft() return len(self.failures)
[ "def", "num_failures", "(", "self", ")", ":", "min_time", "=", "time", ".", "time", "(", ")", "-", "self", ".", "window", "while", "self", ".", "failures", "and", "self", ".", "failures", "[", "0", "]", "<", "min_time", ":", "self", ".", "failures", ...
Return the number of failures in the window.
[ "Return", "the", "number", "of", "failures", "in", "the", "window", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/scheduler.py#L190-L199
31,772
spotify/luigi
luigi/scheduler.py
Worker.is_trivial_worker
def is_trivial_worker(self, state): """ If it's not an assistant having only tasks that are without requirements. We have to pass the state parameter for optimization reasons. """ if self.assistant: return False return all(not task.resources for task ...
python
def is_trivial_worker(self, state): """ If it's not an assistant having only tasks that are without requirements. We have to pass the state parameter for optimization reasons. """ if self.assistant: return False return all(not task.resources for task ...
[ "def", "is_trivial_worker", "(", "self", ",", "state", ")", ":", "if", "self", ".", "assistant", ":", "return", "False", "return", "all", "(", "not", "task", ".", "resources", "for", "task", "in", "self", ".", "get_tasks", "(", "state", ",", "PENDING", ...
If it's not an assistant having only tasks that are without requirements. We have to pass the state parameter for optimization reasons.
[ "If", "it", "s", "not", "an", "assistant", "having", "only", "tasks", "that", "are", "without", "requirements", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/scheduler.py#L401-L410
31,773
spotify/luigi
luigi/scheduler.py
Scheduler._update_priority
def _update_priority(self, task, prio, worker): """ Update priority of the given task. Priority can only be increased. If the task doesn't exist, a placeholder task is created to preserve priority when the task is later scheduled. """ task.priority = prio = max(prio, tas...
python
def _update_priority(self, task, prio, worker): """ Update priority of the given task. Priority can only be increased. If the task doesn't exist, a placeholder task is created to preserve priority when the task is later scheduled. """ task.priority = prio = max(prio, tas...
[ "def", "_update_priority", "(", "self", ",", "task", ",", "prio", ",", "worker", ")", ":", "task", ".", "priority", "=", "prio", "=", "max", "(", "prio", ",", "task", ".", "priority", ")", "for", "dep", "in", "task", ".", "deps", "or", "[", "]", ...
Update priority of the given task. Priority can only be increased. If the task doesn't exist, a placeholder task is created to preserve priority when the task is later scheduled.
[ "Update", "priority", "of", "the", "given", "task", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/scheduler.py#L771-L782
31,774
spotify/luigi
luigi/scheduler.py
Scheduler._traverse_graph
def _traverse_graph(self, root_task_id, seen=None, dep_func=None, include_done=True): """ Returns the dependency graph rooted at task_id This does a breadth-first traversal to find the nodes closest to the root before hitting the scheduler.max_graph_nodes limit. :param root_task_id: th...
python
def _traverse_graph(self, root_task_id, seen=None, dep_func=None, include_done=True): """ Returns the dependency graph rooted at task_id This does a breadth-first traversal to find the nodes closest to the root before hitting the scheduler.max_graph_nodes limit. :param root_task_id: th...
[ "def", "_traverse_graph", "(", "self", ",", "root_task_id", ",", "seen", "=", "None", ",", "dep_func", "=", "None", ",", "include_done", "=", "True", ")", ":", "if", "seen", "is", "None", ":", "seen", "=", "set", "(", ")", "elif", "root_task_id", "in",...
Returns the dependency graph rooted at task_id This does a breadth-first traversal to find the nodes closest to the root before hitting the scheduler.max_graph_nodes limit. :param root_task_id: the id of the graph's root :return: A map of task id to serialized node
[ "Returns", "the", "dependency", "graph", "rooted", "at", "task_id" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/scheduler.py#L1343-L1402
31,775
spotify/luigi
luigi/scheduler.py
Scheduler.task_list
def task_list(self, status='', upstream_status='', limit=True, search=None, max_shown_tasks=None, **kwargs): """ Query for a subset of tasks by status. """ if not search: count_limit = max_shown_tasks or self._config.max_shown_tasks pre_count = s...
python
def task_list(self, status='', upstream_status='', limit=True, search=None, max_shown_tasks=None, **kwargs): """ Query for a subset of tasks by status. """ if not search: count_limit = max_shown_tasks or self._config.max_shown_tasks pre_count = s...
[ "def", "task_list", "(", "self", ",", "status", "=", "''", ",", "upstream_status", "=", "''", ",", "limit", "=", "True", ",", "search", "=", "None", ",", "max_shown_tasks", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "search", ":", ...
Query for a subset of tasks by status.
[ "Query", "for", "a", "subset", "of", "tasks", "by", "status", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/scheduler.py#L1424-L1454
31,776
spotify/luigi
luigi/scheduler.py
Scheduler.resources
def resources(self): ''' get total resources and available ones ''' used_resources = self._used_resources() ret = collections.defaultdict(dict) for resource, total in six.iteritems(self._resources): ret[resource]['total'] = total if resource in used_resources: ...
python
def resources(self): ''' get total resources and available ones ''' used_resources = self._used_resources() ret = collections.defaultdict(dict) for resource, total in six.iteritems(self._resources): ret[resource]['total'] = total if resource in used_resources: ...
[ "def", "resources", "(", "self", ")", ":", "used_resources", "=", "self", ".", "_used_resources", "(", ")", "ret", "=", "collections", ".", "defaultdict", "(", "dict", ")", "for", "resource", ",", "total", "in", "six", ".", "iteritems", "(", "self", ".",...
get total resources and available ones
[ "get", "total", "resources", "and", "available", "ones" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/scheduler.py#L1523-L1533
31,777
spotify/luigi
luigi/scheduler.py
Scheduler.task_search
def task_search(self, task_str, **kwargs): """ Query for a subset of tasks by task_id. :param task_str: :return: """ self.prune() result = collections.defaultdict(dict) for task in self._state.get_active_tasks(): if task.id.find(task_str) != -...
python
def task_search(self, task_str, **kwargs): """ Query for a subset of tasks by task_id. :param task_str: :return: """ self.prune() result = collections.defaultdict(dict) for task in self._state.get_active_tasks(): if task.id.find(task_str) != -...
[ "def", "task_search", "(", "self", ",", "task_str", ",", "*", "*", "kwargs", ")", ":", "self", ".", "prune", "(", ")", "result", "=", "collections", ".", "defaultdict", "(", "dict", ")", "for", "task", "in", "self", ".", "_state", ".", "get_active_task...
Query for a subset of tasks by task_id. :param task_str: :return:
[ "Query", "for", "a", "subset", "of", "tasks", "by", "task_id", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/scheduler.py#L1536-L1549
31,778
spotify/luigi
luigi/target.py
FileSystemTarget.exists
def exists(self): """ Returns ``True`` if the path for this FileSystemTarget exists; ``False`` otherwise. This method is implemented by using :py:attr:`fs`. """ path = self.path if '*' in path or '?' in path or '[' in path or '{' in path: logger.warning("Usin...
python
def exists(self): """ Returns ``True`` if the path for this FileSystemTarget exists; ``False`` otherwise. This method is implemented by using :py:attr:`fs`. """ path = self.path if '*' in path or '?' in path or '[' in path or '{' in path: logger.warning("Usin...
[ "def", "exists", "(", "self", ")", ":", "path", "=", "self", ".", "path", "if", "'*'", "in", "path", "or", "'?'", "in", "path", "or", "'['", "in", "path", "or", "'{'", "in", "path", ":", "logger", ".", "warning", "(", "\"Using wildcards in path %s migh...
Returns ``True`` if the path for this FileSystemTarget exists; ``False`` otherwise. This method is implemented by using :py:attr:`fs`.
[ "Returns", "True", "if", "the", "path", "for", "this", "FileSystemTarget", "exists", ";", "False", "otherwise", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/target.py#L242-L252
31,779
spotify/luigi
luigi/contrib/esindex.py
ElasticsearchTarget.marker_index_document_id
def marker_index_document_id(self): """ Generate an id for the indicator document. """ params = '%s:%s:%s' % (self.index, self.doc_type, self.update_id) return hashlib.sha1(params.encode('utf-8')).hexdigest()
python
def marker_index_document_id(self): """ Generate an id for the indicator document. """ params = '%s:%s:%s' % (self.index, self.doc_type, self.update_id) return hashlib.sha1(params.encode('utf-8')).hexdigest()
[ "def", "marker_index_document_id", "(", "self", ")", ":", "params", "=", "'%s:%s:%s'", "%", "(", "self", ".", "index", ",", "self", ".", "doc_type", ",", "self", ".", "update_id", ")", "return", "hashlib", ".", "sha1", "(", "params", ".", "encode", "(", ...
Generate an id for the indicator document.
[ "Generate", "an", "id", "for", "the", "indicator", "document", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/esindex.py#L161-L166
31,780
spotify/luigi
luigi/contrib/esindex.py
ElasticsearchTarget.exists
def exists(self): """ Test, if this task has been run. """ try: self.es.get(index=self.marker_index, doc_type=self.marker_doc_type, id=self.marker_index_document_id()) return True except elasticsearch.NotFoundError: logger.debug('Marker documen...
python
def exists(self): """ Test, if this task has been run. """ try: self.es.get(index=self.marker_index, doc_type=self.marker_doc_type, id=self.marker_index_document_id()) return True except elasticsearch.NotFoundError: logger.debug('Marker documen...
[ "def", "exists", "(", "self", ")", ":", "try", ":", "self", ".", "es", ".", "get", "(", "index", "=", "self", ".", "marker_index", ",", "doc_type", "=", "self", ".", "marker_doc_type", ",", "id", "=", "self", ".", "marker_index_document_id", "(", ")", ...
Test, if this task has been run.
[ "Test", "if", "this", "task", "has", "been", "run", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/esindex.py#L186-L197
31,781
spotify/luigi
luigi/contrib/esindex.py
ElasticsearchTarget.create_marker_index
def create_marker_index(self): """ Create the index that will keep track of the tasks if necessary. """ if not self.es.indices.exists(index=self.marker_index): self.es.indices.create(index=self.marker_index)
python
def create_marker_index(self): """ Create the index that will keep track of the tasks if necessary. """ if not self.es.indices.exists(index=self.marker_index): self.es.indices.create(index=self.marker_index)
[ "def", "create_marker_index", "(", "self", ")", ":", "if", "not", "self", ".", "es", ".", "indices", ".", "exists", "(", "index", "=", "self", ".", "marker_index", ")", ":", "self", ".", "es", ".", "indices", ".", "create", "(", "index", "=", "self",...
Create the index that will keep track of the tasks if necessary.
[ "Create", "the", "index", "that", "will", "keep", "track", "of", "the", "tasks", "if", "necessary", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/esindex.py#L199-L204
31,782
spotify/luigi
luigi/contrib/esindex.py
CopyToIndex._docs
def _docs(self): """ Since `self.docs` may yield documents that do not explicitly contain `_index` or `_type`, add those attributes here, if necessary. """ iterdocs = iter(self.docs()) first = next(iterdocs) needs_parsing = False if isinstance(first, six.s...
python
def _docs(self): """ Since `self.docs` may yield documents that do not explicitly contain `_index` or `_type`, add those attributes here, if necessary. """ iterdocs = iter(self.docs()) first = next(iterdocs) needs_parsing = False if isinstance(first, six.s...
[ "def", "_docs", "(", "self", ")", ":", "iterdocs", "=", "iter", "(", "self", ".", "docs", "(", ")", ")", "first", "=", "next", "(", "iterdocs", ")", "needs_parsing", "=", "False", "if", "isinstance", "(", "first", ",", "six", ".", "string_types", ")"...
Since `self.docs` may yield documents that do not explicitly contain `_index` or `_type`, add those attributes here, if necessary.
[ "Since", "self", ".", "docs", "may", "yield", "documents", "that", "do", "not", "explicitly", "contain", "_index", "or", "_type", "add", "those", "attributes", "here", "if", "necessary", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/esindex.py#L361-L382
31,783
spotify/luigi
luigi/contrib/esindex.py
CopyToIndex.create_index
def create_index(self): """ Override to provide code for creating the target index. By default it will be created without any special settings or mappings. """ es = self._init_connection() if not es.indices.exists(index=self.index): es.indices.create(index=se...
python
def create_index(self): """ Override to provide code for creating the target index. By default it will be created without any special settings or mappings. """ es = self._init_connection() if not es.indices.exists(index=self.index): es.indices.create(index=se...
[ "def", "create_index", "(", "self", ")", ":", "es", "=", "self", ".", "_init_connection", "(", ")", "if", "not", "es", ".", "indices", ".", "exists", "(", "index", "=", "self", ".", "index", ")", ":", "es", ".", "indices", ".", "create", "(", "inde...
Override to provide code for creating the target index. By default it will be created without any special settings or mappings.
[ "Override", "to", "provide", "code", "for", "creating", "the", "target", "index", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/esindex.py#L394-L402
31,784
spotify/luigi
luigi/contrib/esindex.py
CopyToIndex.delete_index
def delete_index(self): """ Delete the index, if it exists. """ es = self._init_connection() if es.indices.exists(index=self.index): es.indices.delete(index=self.index)
python
def delete_index(self): """ Delete the index, if it exists. """ es = self._init_connection() if es.indices.exists(index=self.index): es.indices.delete(index=self.index)
[ "def", "delete_index", "(", "self", ")", ":", "es", "=", "self", ".", "_init_connection", "(", ")", "if", "es", ".", "indices", ".", "exists", "(", "index", "=", "self", ".", "index", ")", ":", "es", ".", "indices", ".", "delete", "(", "index", "="...
Delete the index, if it exists.
[ "Delete", "the", "index", "if", "it", "exists", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/esindex.py#L404-L410
31,785
spotify/luigi
luigi/contrib/esindex.py
CopyToIndex.output
def output(self): """ Returns a ElasticsearchTarget representing the inserted dataset. Normally you don't override this. """ return ElasticsearchTarget( host=self.host, port=self.port, http_auth=self.http_auth, index=self.index, ...
python
def output(self): """ Returns a ElasticsearchTarget representing the inserted dataset. Normally you don't override this. """ return ElasticsearchTarget( host=self.host, port=self.port, http_auth=self.http_auth, index=self.index, ...
[ "def", "output", "(", "self", ")", ":", "return", "ElasticsearchTarget", "(", "host", "=", "self", ".", "host", ",", "port", "=", "self", ".", "port", ",", "http_auth", "=", "self", ".", "http_auth", ",", "index", "=", "self", ".", "index", ",", "doc...
Returns a ElasticsearchTarget representing the inserted dataset. Normally you don't override this.
[ "Returns", "a", "ElasticsearchTarget", "representing", "the", "inserted", "dataset", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/esindex.py#L418-L434
31,786
spotify/luigi
luigi/contrib/kubernetes.py
KubernetesJobTask.__track_job
def __track_job(self): """Poll job status while active""" while not self.__verify_job_has_started(): time.sleep(self.__POLL_TIME) self.__logger.debug("Waiting for Kubernetes job " + self.uu_name + " to start") self.__print_kubectl_hints() status = self.__get_job_...
python
def __track_job(self): """Poll job status while active""" while not self.__verify_job_has_started(): time.sleep(self.__POLL_TIME) self.__logger.debug("Waiting for Kubernetes job " + self.uu_name + " to start") self.__print_kubectl_hints() status = self.__get_job_...
[ "def", "__track_job", "(", "self", ")", ":", "while", "not", "self", ".", "__verify_job_has_started", "(", ")", ":", "time", ".", "sleep", "(", "self", ".", "__POLL_TIME", ")", "self", ".", "__logger", ".", "debug", "(", "\"Waiting for Kubernetes job \"", "+...
Poll job status while active
[ "Poll", "job", "status", "while", "active" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/kubernetes.py#L211-L228
31,787
spotify/luigi
luigi/contrib/kubernetes.py
KubernetesJobTask.__verify_job_has_started
def __verify_job_has_started(self): """Asserts that the job has successfully started""" # Verify that the job started self.__get_job() # Verify that the pod started pods = self.__get_pods() assert len(pods) > 0, "No pod scheduled by " + self.uu_name for pod in p...
python
def __verify_job_has_started(self): """Asserts that the job has successfully started""" # Verify that the job started self.__get_job() # Verify that the pod started pods = self.__get_pods() assert len(pods) > 0, "No pod scheduled by " + self.uu_name for pod in p...
[ "def", "__verify_job_has_started", "(", "self", ")", ":", "# Verify that the job started", "self", ".", "__get_job", "(", ")", "# Verify that the pod started", "pods", "=", "self", ".", "__get_pods", "(", ")", "assert", "len", "(", "pods", ")", ">", "0", ",", ...
Asserts that the job has successfully started
[ "Asserts", "that", "the", "job", "has", "successfully", "started" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/kubernetes.py#L267-L296
31,788
spotify/luigi
luigi/contrib/kubernetes.py
KubernetesJobTask.__get_job_status
def __get_job_status(self): """Return the Kubernetes job status""" # Figure out status and return it job = self.__get_job() if "succeeded" in job.obj["status"] and job.obj["status"]["succeeded"] > 0: job.scale(replicas=0) if self.print_pod_logs_on_exit: ...
python
def __get_job_status(self): """Return the Kubernetes job status""" # Figure out status and return it job = self.__get_job() if "succeeded" in job.obj["status"] and job.obj["status"]["succeeded"] > 0: job.scale(replicas=0) if self.print_pod_logs_on_exit: ...
[ "def", "__get_job_status", "(", "self", ")", ":", "# Figure out status and return it", "job", "=", "self", ".", "__get_job", "(", ")", "if", "\"succeeded\"", "in", "job", ".", "obj", "[", "\"status\"", "]", "and", "job", ".", "obj", "[", "\"status\"", "]", ...
Return the Kubernetes job status
[ "Return", "the", "Kubernetes", "job", "status" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/kubernetes.py#L298-L320
31,789
spotify/luigi
luigi/contrib/sqla.py
SQLAlchemyTarget.engine
def engine(self): """ Return an engine instance, creating it if it doesn't exist. Recreate the engine connection if it wasn't originally created by the current process. """ pid = os.getpid() conn = SQLAlchemyTarget._engine_dict.get(self.connection_string) ...
python
def engine(self): """ Return an engine instance, creating it if it doesn't exist. Recreate the engine connection if it wasn't originally created by the current process. """ pid = os.getpid() conn = SQLAlchemyTarget._engine_dict.get(self.connection_string) ...
[ "def", "engine", "(", "self", ")", ":", "pid", "=", "os", ".", "getpid", "(", ")", "conn", "=", "SQLAlchemyTarget", ".", "_engine_dict", ".", "get", "(", "self", ".", "connection_string", ")", "if", "not", "conn", "or", "conn", ".", "pid", "!=", "pid...
Return an engine instance, creating it if it doesn't exist. Recreate the engine connection if it wasn't originally created by the current process.
[ "Return", "an", "engine", "instance", "creating", "it", "if", "it", "doesn", "t", "exist", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/sqla.py#L193-L210
31,790
spotify/luigi
luigi/contrib/hdfs/target.py
HdfsTarget.rename
def rename(self, path, raise_if_exists=False): """ Does not change self.path. Unlike ``move_dir()``, ``rename()`` might cause nested directories. See spotify/luigi#522 """ if isinstance(path, HdfsTarget): path = path.path if raise_if_exists and self.f...
python
def rename(self, path, raise_if_exists=False): """ Does not change self.path. Unlike ``move_dir()``, ``rename()`` might cause nested directories. See spotify/luigi#522 """ if isinstance(path, HdfsTarget): path = path.path if raise_if_exists and self.f...
[ "def", "rename", "(", "self", ",", "path", ",", "raise_if_exists", "=", "False", ")", ":", "if", "isinstance", "(", "path", ",", "HdfsTarget", ")", ":", "path", "=", "path", ".", "path", "if", "raise_if_exists", "and", "self", ".", "fs", ".", "exists",...
Does not change self.path. Unlike ``move_dir()``, ``rename()`` might cause nested directories. See spotify/luigi#522
[ "Does", "not", "change", "self", ".", "path", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hdfs/target.py#L121-L132
31,791
spotify/luigi
luigi/contrib/hdfs/target.py
HdfsTarget.is_writable
def is_writable(self): """ Currently only works with hadoopcli """ if "/" in self.path: # example path: /log/ap/2013-01-17/00 parts = self.path.split("/") # start with the full path and then up the tree until we can check length = len(parts...
python
def is_writable(self): """ Currently only works with hadoopcli """ if "/" in self.path: # example path: /log/ap/2013-01-17/00 parts = self.path.split("/") # start with the full path and then up the tree until we can check length = len(parts...
[ "def", "is_writable", "(", "self", ")", ":", "if", "\"/\"", "in", "self", ".", "path", ":", "# example path: /log/ap/2013-01-17/00", "parts", "=", "self", ".", "path", ".", "split", "(", "\"/\"", ")", "# start with the full path and then up the tree until we can check...
Currently only works with hadoopcli
[ "Currently", "only", "works", "with", "hadoopcli" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hdfs/target.py#L158-L178
31,792
spotify/luigi
luigi/execution_summary.py
_partition_tasks
def _partition_tasks(worker): """ Takes a worker and sorts out tasks based on their status. Still_pending_not_ext is only used to get upstream_failure, upstream_missing_dependency and run_by_other_worker """ task_history = worker._add_task_history pending_tasks = {task for(task, status, ext) in ...
python
def _partition_tasks(worker): """ Takes a worker and sorts out tasks based on their status. Still_pending_not_ext is only used to get upstream_failure, upstream_missing_dependency and run_by_other_worker """ task_history = worker._add_task_history pending_tasks = {task for(task, status, ext) in ...
[ "def", "_partition_tasks", "(", "worker", ")", ":", "task_history", "=", "worker", ".", "_add_task_history", "pending_tasks", "=", "{", "task", "for", "(", "task", ",", "status", ",", "ext", ")", "in", "task_history", "if", "status", "==", "'PENDING'", "}", ...
Takes a worker and sorts out tasks based on their status. Still_pending_not_ext is only used to get upstream_failure, upstream_missing_dependency and run_by_other_worker
[ "Takes", "a", "worker", "and", "sorts", "out", "tasks", "based", "on", "their", "status", ".", "Still_pending_not_ext", "is", "only", "used", "to", "get", "upstream_failure", "upstream_missing_dependency", "and", "run_by_other_worker" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/execution_summary.py#L91-L115
31,793
spotify/luigi
luigi/execution_summary.py
_depth_first_search
def _depth_first_search(set_tasks, current_task, visited): """ This dfs checks why tasks are still pending. """ visited.add(current_task) if current_task in set_tasks["still_pending_not_ext"]: upstream_failure = False upstream_missing_dependency = False upstream_run_by_other_...
python
def _depth_first_search(set_tasks, current_task, visited): """ This dfs checks why tasks are still pending. """ visited.add(current_task) if current_task in set_tasks["still_pending_not_ext"]: upstream_failure = False upstream_missing_dependency = False upstream_run_by_other_...
[ "def", "_depth_first_search", "(", "set_tasks", ",", "current_task", ",", "visited", ")", ":", "visited", ".", "add", "(", "current_task", ")", "if", "current_task", "in", "set_tasks", "[", "\"still_pending_not_ext\"", "]", ":", "upstream_failure", "=", "False", ...
This dfs checks why tasks are still pending.
[ "This", "dfs", "checks", "why", "tasks", "are", "still", "pending", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/execution_summary.py#L134-L162
31,794
spotify/luigi
luigi/execution_summary.py
_ranging_attributes
def _ranging_attributes(attributes, param_class): """ Checks if there is a continuous range """ next_attributes = {param_class.next_in_enumeration(attribute) for attribute in attributes} in_first = attributes.difference(next_attributes) in_second = next_attributes.difference(attributes) if l...
python
def _ranging_attributes(attributes, param_class): """ Checks if there is a continuous range """ next_attributes = {param_class.next_in_enumeration(attribute) for attribute in attributes} in_first = attributes.difference(next_attributes) in_second = next_attributes.difference(attributes) if l...
[ "def", "_ranging_attributes", "(", "attributes", ",", "param_class", ")", ":", "next_attributes", "=", "{", "param_class", ".", "next_in_enumeration", "(", "attribute", ")", "for", "attribute", "in", "attributes", "}", "in_first", "=", "attributes", ".", "differen...
Checks if there is a continuous range
[ "Checks", "if", "there", "is", "a", "continuous", "range" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/execution_summary.py#L257-L268
31,795
spotify/luigi
luigi/execution_summary.py
_get_comments
def _get_comments(group_tasks): """ Get the human readable comments and quantities for the task types. """ comments = {} for status, human in _COMMENTS: num_tasks = _get_number_of_tasks_for(status, group_tasks) if num_tasks: space = " " if status in _PENDING_SUB_STATUS...
python
def _get_comments(group_tasks): """ Get the human readable comments and quantities for the task types. """ comments = {} for status, human in _COMMENTS: num_tasks = _get_number_of_tasks_for(status, group_tasks) if num_tasks: space = " " if status in _PENDING_SUB_STATUS...
[ "def", "_get_comments", "(", "group_tasks", ")", ":", "comments", "=", "{", "}", "for", "status", ",", "human", "in", "_COMMENTS", ":", "num_tasks", "=", "_get_number_of_tasks_for", "(", "status", ",", "group_tasks", ")", "if", "num_tasks", ":", "space", "="...
Get the human readable comments and quantities for the task types.
[ "Get", "the", "human", "readable", "comments", "and", "quantities", "for", "the", "task", "types", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/execution_summary.py#L301-L314
31,796
spotify/luigi
luigi/execution_summary.py
_get_run_by_other_worker
def _get_run_by_other_worker(worker): """ This returns a set of the tasks that are being run by other worker """ task_sets = _get_external_workers(worker).values() return functools.reduce(lambda a, b: a | b, task_sets, set())
python
def _get_run_by_other_worker(worker): """ This returns a set of the tasks that are being run by other worker """ task_sets = _get_external_workers(worker).values() return functools.reduce(lambda a, b: a | b, task_sets, set())
[ "def", "_get_run_by_other_worker", "(", "worker", ")", ":", "task_sets", "=", "_get_external_workers", "(", "worker", ")", ".", "values", "(", ")", "return", "functools", ".", "reduce", "(", "lambda", "a", ",", "b", ":", "a", "|", "b", ",", "task_sets", ...
This returns a set of the tasks that are being run by other worker
[ "This", "returns", "a", "set", "of", "the", "tasks", "that", "are", "being", "run", "by", "other", "worker" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/execution_summary.py#L350-L355
31,797
spotify/luigi
luigi/execution_summary.py
_get_external_workers
def _get_external_workers(worker): """ This returns a dict with a set of tasks for all of the other workers """ worker_that_blocked_task = collections.defaultdict(set) get_work_response_history = worker._get_work_response_history for get_work_response in get_work_response_history: if get...
python
def _get_external_workers(worker): """ This returns a dict with a set of tasks for all of the other workers """ worker_that_blocked_task = collections.defaultdict(set) get_work_response_history = worker._get_work_response_history for get_work_response in get_work_response_history: if get...
[ "def", "_get_external_workers", "(", "worker", ")", ":", "worker_that_blocked_task", "=", "collections", ".", "defaultdict", "(", "set", ")", "get_work_response_history", "=", "worker", ".", "_get_work_response_history", "for", "get_work_response", "in", "get_work_respons...
This returns a dict with a set of tasks for all of the other workers
[ "This", "returns", "a", "dict", "with", "a", "set", "of", "tasks", "for", "all", "of", "the", "other", "workers" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/execution_summary.py#L358-L373
31,798
spotify/luigi
luigi/execution_summary.py
_group_tasks_by_name_and_status
def _group_tasks_by_name_and_status(task_dict): """ Takes a dictionary with sets of tasks grouped by their status and returns a dictionary with dictionaries with an array of tasks grouped by their status and task name """ group_status = {} for task in task_dict: if task.task_family n...
python
def _group_tasks_by_name_and_status(task_dict): """ Takes a dictionary with sets of tasks grouped by their status and returns a dictionary with dictionaries with an array of tasks grouped by their status and task name """ group_status = {} for task in task_dict: if task.task_family n...
[ "def", "_group_tasks_by_name_and_status", "(", "task_dict", ")", ":", "group_status", "=", "{", "}", "for", "task", "in", "task_dict", ":", "if", "task", ".", "task_family", "not", "in", "group_status", ":", "group_status", "[", "task", ".", "task_family", "]"...
Takes a dictionary with sets of tasks grouped by their status and returns a dictionary with dictionaries with an array of tasks grouped by their status and task name
[ "Takes", "a", "dictionary", "with", "sets", "of", "tasks", "grouped", "by", "their", "status", "and", "returns", "a", "dictionary", "with", "dictionaries", "with", "an", "array", "of", "tasks", "grouped", "by", "their", "status", "and", "task", "name" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/execution_summary.py#L376-L387
31,799
spotify/luigi
luigi/execution_summary.py
_tasks_status
def _tasks_status(set_tasks): """ Given a grouped set of tasks, returns a LuigiStatusCode """ if set_tasks["ever_failed"]: if not set_tasks["failed"]: return LuigiStatusCode.SUCCESS_WITH_RETRY else: if set_tasks["scheduling_error"]: return LuigiSta...
python
def _tasks_status(set_tasks): """ Given a grouped set of tasks, returns a LuigiStatusCode """ if set_tasks["ever_failed"]: if not set_tasks["failed"]: return LuigiStatusCode.SUCCESS_WITH_RETRY else: if set_tasks["scheduling_error"]: return LuigiSta...
[ "def", "_tasks_status", "(", "set_tasks", ")", ":", "if", "set_tasks", "[", "\"ever_failed\"", "]", ":", "if", "not", "set_tasks", "[", "\"failed\"", "]", ":", "return", "LuigiStatusCode", ".", "SUCCESS_WITH_RETRY", "else", ":", "if", "set_tasks", "[", "\"sche...
Given a grouped set of tasks, returns a LuigiStatusCode
[ "Given", "a", "grouped", "set", "of", "tasks", "returns", "a", "LuigiStatusCode" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/execution_summary.py#L450-L468