id
int64
0
328k
repository_name
stringlengths
7
58
file_path
stringlengths
9
302
class_name
stringlengths
5
256
human_written_code
stringlengths
16
2.16M
class_skeleton
stringlengths
18
1.49M
⌀
total_program_units
int64
1
1.76k
total_doc_str
int64
0
771
AvgCountLine
float64
0
7.89k
AvgCountLineBlank
float64
0
297
AvgCountLineCode
float64
0
7.89k
AvgCountLineComment
float64
0
7.89k
AvgCyclomatic
float64
0
130
CommentToCodeRatio
float64
0
168
CountClassBase
float64
0
40
CountClassCoupled
float64
0
583
CountClassCoupledModified
float64
0
575
CountClassDerived
float64
0
5.35k
CountDeclInstanceMethod
float64
0
529
CountDeclInstanceVariable
float64
0
296
CountDeclMethod
float64
0
599
CountDeclMethodAll
float64
0
1.12k
CountLine
float64
1
40.4k
CountLineBlank
float64
0
8.16k
CountLineCode
float64
1
25.7k
CountLineCodeDecl
float64
1
8.15k
CountLineCodeExe
float64
0
24.2k
CountLineComment
float64
0
16.5k
CountStmt
float64
1
9.71k
CountStmtDecl
float64
1
8.15k
CountStmtExe
float64
0
9.69k
MaxCyclomatic
float64
0
759
MaxInheritanceTree
float64
0
16
MaxNesting
float64
0
34
SumCyclomatic
float64
0
2.9k
17,700
spotify/luigi
spotify_luigi/luigi/contrib/dataproc.py
luigi.contrib.dataproc._DataprocBaseTask
import luigi class _DataprocBaseTask(luigi.Task): gcloud_project_id = luigi.Parameter(significant=False, positional=False) dataproc_cluster_name = luigi.Parameter(significant=False, positional=False) dataproc_region = luigi.Parameter(default='global', significant=False, positional=False) dataproc_clien...
class _DataprocBaseTask(luigi.Task): pass
1
0
0
0
0
0
0
0
1
0
0
3
0
0
0
78
6
1
5
5
4
0
5
5
4
0
5
0
0
17,701
spotify/luigi
spotify_luigi/luigi/contrib/docker_runner.py
luigi.contrib.docker_runner.DockerTask
import luigi from tempfile import mkdtemp from luigi.local_target import LocalFileSystem class DockerTask(luigi.Task): @property def image(self): return 'alpine' @property def command(self): return 'echo hello world' @property def name(self): return None @propert...
class DockerTask(luigi.Task): @property def image(self): pass @property def command(self): pass @property def name(self): pass @property def host_config_options(self): ''' Override this to specify host_config options like gpu requests or shm ...
29
4
11
1
8
3
2
0.31
1
6
1
7
15
7
15
93
200
33
127
46
98
40
95
32
79
17
5
3
35
17,702
spotify/luigi
spotify_luigi/luigi/contrib/dropbox.py
luigi.contrib.dropbox.AtomicWritableDropboxFile
from luigi.target import FileSystem, FileSystemTarget, AtomicLocalFile class AtomicWritableDropboxFile(AtomicLocalFile): def __init__(self, path, client): """ Represents a file that will be created inside the Dropbox cloud :param str path: Destination path inside Dropbox :param Dr...
class AtomicWritableDropboxFile(AtomicLocalFile): def __init__(self, path, client): ''' Represents a file that will be created inside the Dropbox cloud :param str path: Destination path inside Dropbox :param DropboxClient client: a DropboxClient object (initialized with a valid tok...
3
2
8
1
3
4
1
1.14
1
1
0
0
2
2
2
9
17
2
7
5
4
8
7
5
4
1
1
0
2
17,703
spotify/luigi
spotify_luigi/luigi/contrib/dropbox.py
luigi.contrib.dropbox.DropboxClient
import luigi.format import os from luigi.target import FileSystem, FileSystemTarget, AtomicLocalFile class DropboxClient(FileSystem): """ Dropbox client for authentication, designed to be used by the :py:class:`DropboxTarget` class. """ def __init__(self, token, user_agent='Luigi', root_namespace_id=N...
class DropboxClient(FileSystem): ''' Dropbox client for authentication, designed to be used by the :py:class:`DropboxTarget` class. ''' def __init__(self, token, user_agent='Luigi', root_namespace_id=None): ''' :param str token: Dropbox Oauth2 Token. See :class:`DropboxTarget` for ...
19
3
10
1
8
1
3
0.11
1
4
2
0
11
2
11
40
129
19
99
37
80
11
86
26
74
5
4
3
31
17,704
spotify/luigi
spotify_luigi/luigi/contrib/dropbox.py
luigi.contrib.dropbox.DropboxTarget
import random from luigi.target import FileSystem, FileSystemTarget, AtomicLocalFile from contextlib import contextmanager import os import tempfile import ntpath import luigi.format class DropboxTarget(FileSystemTarget): """ A Dropbox filesystem target. """ def __init__(self, path, token, format=None...
class DropboxTarget(FileSystemTarget): ''' A Dropbox filesystem target. ''' def __init__(self, path, token, format=None, user_agent='Luigi', root_namespace_id=None): ''' Create an Dropbox Target for storing data in a dropbox.com account **About the path parameter** The ...
8
2
12
3
5
4
2
0.8
1
5
3
0
5
4
5
35
73
19
30
15
22
24
25
13
19
3
5
1
8
17,705
spotify/luigi
spotify_luigi/luigi/contrib/dropbox.py
luigi.contrib.dropbox.ReadableDropboxFile
import time import ntpath import os import tempfile class ReadableDropboxFile: def __init__(self, path, client): """ Represents a file inside the Dropbox cloud which will be read :param str path: Dropbpx path of the file to be read (always starting with /) :param DropboxClient cli...
class ReadableDropboxFile: def __init__(self, path, client): ''' Represents a file inside the Dropbox cloud which will be read :param str path: Dropbpx path of the file to be read (always starting with /) :param DropboxClient client: a DropboxClient object (initialized with a valid...
10
1
4
0
3
1
1
0.19
0
1
0
0
9
5
9
9
41
10
26
15
16
5
25
15
15
2
0
1
10
17,706
spotify/luigi
spotify_luigi/luigi/contrib/ecs.py
luigi.contrib.ecs.ECSTask
import copy import luigi class ECSTask(luigi.Task): """ Base class for an Amazon EC2 Container Service Task Amazon ECS requires you to register "tasks", which are JSON descriptions for how to issue the ``docker run`` command. This Luigi Task can either run a pre-registered ECS taskDefinition, OR r...
class ECSTask(luigi.Task): ''' Base class for an Amazon EC2 Container Service Task Amazon ECS requires you to register "tasks", which are JSON descriptions for how to issue the ``docker run`` command. This Luigi Task can either run a pre-registered ECS taskDefinition, OR register the task on the fl...
12
6
20
3
7
11
2
1.78
1
3
0
1
5
1
6
84
172
30
51
21
39
91
38
16
31
4
5
3
14
17,707
spotify/luigi
spotify_luigi/luigi/contrib/esindex.py
luigi.contrib.esindex.CopyToIndex
import json import abc import luigi import itertools class CopyToIndex(luigi.Task): """ Template task for inserting a data set into Elasticsearch. Usage: 1. Subclass and override the required `index` attribute. 2. Implement a custom `docs` method, that returns an iterable over the documents. ...
class CopyToIndex(luigi.Task): ''' Template task for inserting a data set into Elasticsearch. Usage: 1. Subclass and override the required `index` attribute. 2. Implement a custom `docs` method, that returns an iterable over the documents. A document can be a JSON string, e.g. from a ...
36
21
8
0
5
4
2
0.86
1
5
1
2
21
0
21
99
240
35
110
44
74
95
73
30
51
7
5
2
32
17,708
spotify/luigi
spotify_luigi/luigi/contrib/esindex.py
luigi.contrib.esindex.ElasticsearchTarget
import hashlib import datetime import luigi class ElasticsearchTarget(luigi.Target): """ Target for a resource in Elasticsearch.""" marker_index = luigi.configuration.get_config().get('elasticsearch', 'marker-index', 'update_log') marker_doc_type = luigi.configuration.get_config().get('elasticsearch', 'mar...
class ElasticsearchTarget(luigi.Target): ''' Target for a resource in Elasticsearch.''' def __init__(self, host, port, index, doc_type, update_id, marker_index_hist_size=0, http_auth=None, timeout=10, extra_elasticsearch_args=None): ''' :param host: Elasticsearch server host :type host...
7
7
17
1
10
6
2
0.58
1
2
0
0
6
10
6
27
115
11
66
26
57
38
45
23
38
4
4
2
13
17,709
spotify/luigi
spotify_luigi/luigi/contrib/external_daily_snapshot.py
luigi.contrib.external_daily_snapshot.ExternalDailySnapshot
import luigi import datetime class ExternalDailySnapshot(luigi.ExternalTask): """ Abstract class containing a helper method to fetch the latest snapshot. Example:: class MyTask(luigi.Task): def requires(self): return PlaylistContent.latest() All tasks subclassing :class:`Exte...
class ExternalDailySnapshot(luigi.ExternalTask): ''' Abstract class containing a helper method to fetch the latest snapshot. Example:: class MyTask(luigi.Task): def requires(self): return PlaylistContent.latest() All tasks subclassing :class:`ExternalDailySnapshot` must have a :...
5
2
12
0
11
1
3
0.58
1
3
0
1
0
0
2
80
50
9
26
15
21
15
23
13
20
3
6
2
6
17,710
spotify/luigi
spotify_luigi/luigi/contrib/external_program.py
luigi.contrib.external_program.ExternalProgramRunContext
import signal import sys class ExternalProgramRunContext: def __init__(self, proc): self.proc = proc def __enter__(self): self.__old_signal = signal.getsignal(signal.SIGTERM) signal.signal(signal.SIGTERM, self.kill_job) return self def __exit__(self, exc_type, exc_val, ex...
class ExternalProgramRunContext: def __init__(self, proc): pass def __enter__(self): pass def __exit__(self, exc_type, exc_val, exc_tb): pass def kill_job(self, captured_signal=None, stack_frame=None): pass
5
0
4
0
4
0
2
0.07
0
1
0
0
4
2
4
4
19
3
15
7
10
1
15
7
10
2
0
1
6
17,711
spotify/luigi
spotify_luigi/luigi/contrib/external_program.py
luigi.contrib.external_program.ExternalProgramRunError
class ExternalProgramRunError(RuntimeError): def __init__(self, message, args, env=None, stdout=None, stderr=None): super(ExternalProgramRunError, self).__init__(message, args, env, stdout, stderr) self.message = message self.args = args self.env = env self.out = stdout ...
class ExternalProgramRunError(RuntimeError): def __init__(self, message, args, env=None, stdout=None, stderr=None): pass def __str__(self): pass
3
0
10
0
9
1
2
0.05
1
1
0
0
2
5
2
13
21
1
19
10
16
1
19
10
16
2
4
1
3
17,712
spotify/luigi
spotify_luigi/luigi/contrib/external_program.py
luigi.contrib.external_program.ExternalProgramTask
import subprocess from time import sleep import tempfile from multiprocessing import Process import os import luigi from contextlib import contextmanager from luigi.parameter import ParameterVisibility import re class ExternalProgramTask(luigi.Task): """ Template task for running an external program in a subpr...
null
11
6
16
1
12
3
3
0.51
1
7
2
5
7
0
7
85
160
26
89
31
78
45
73
28
64
9
5
4
22
17,713
spotify/luigi
spotify_luigi/luigi/contrib/external_program.py
luigi.contrib.external_program.ExternalPythonProgramTask
import luigi class ExternalPythonProgramTask(ExternalProgramTask): """ Template task for running an external Python program in a subprocess Simple extension of :py:class:`ExternalProgramTask`, adding two :py:class:`luigi.parameter.Parameter` s for setting a virtualenv and for extending the ``PYTHO...
class ExternalPythonProgramTask(ExternalProgramTask): ''' Template task for running an external Python program in a subprocess Simple extension of :py:class:`ExternalProgramTask`, adding two :py:class:`luigi.parameter.Parameter` s for setting a virtualenv and for extending the ``PYTHONPATH``. '...
2
1
18
3
13
2
3
0.32
1
1
0
1
1
0
1
86
38
5
25
7
23
8
13
7
11
3
6
1
3
17,714
spotify/luigi
spotify_luigi/luigi/contrib/ftp.py
luigi.contrib.ftp.AtomicFtpFile
import luigi.format import luigi.local_target import luigi.target import luigi class AtomicFtpFile(luigi.target.AtomicLocalFile): """ Simple class that writes to a temp file and upload to ftp on close(). Also cleans up the temp file if close is not invoked. """ def __init__(self, fs, path): ...
class AtomicFtpFile(luigi.target.AtomicLocalFile): ''' Simple class that writes to a temp file and upload to ftp on close(). Also cleans up the temp file if close is not invoked. ''' def __init__(self, fs, path): ''' Initializes an AtomicFtpfile instance. :param fs: ...
5
2
4
0
2
2
1
1.11
1
1
0
0
3
1
3
10
23
4
9
6
4
10
8
5
4
1
1
0
3
17,715
spotify/luigi
spotify_luigi/luigi/contrib/ftp.py
luigi.contrib.ftp.RemoteFileSystem
import os import luigi.local_target import datetime import luigi import random import luigi.format import ftplib import luigi.target class RemoteFileSystem(luigi.target.FileSystem): def __init__(self, host, username=None, password=None, port=None, tls=False, timeout=60, sftp=False, pysftp_conn_kwargs=None): ...
null
24
8
12
2
8
2
2
0.27
1
6
0
0
23
9
23
52
294
60
188
59
162
50
170
57
145
7
4
2
57
17,716
spotify/luigi
spotify_luigi/luigi/contrib/ftp.py
luigi.contrib.ftp.RemoteTarget
import io from luigi.format import FileWrapper import luigi.local_target import os import luigi.target import random import luigi.format import luigi import tempfile class RemoteTarget(luigi.target.FileSystemTarget): """ Target used for reading from remote files. The target is implemented using intermedia...
null
8
2
11
1
8
2
2
0.38
1
6
3
0
6
9
6
36
78
13
47
22
35
18
32
17
25
4
5
2
10
17,717
spotify/luigi
spotify_luigi/luigi/contrib/gcs.py
luigi.contrib.gcs.AtomicGCSFile
import luigi.target class AtomicGCSFile(luigi.target.AtomicLocalFile): """ A GCS file that writes to a temp file and put to GCS on close. """ def __init__(self, path, gcs_client): self.gcs_client = gcs_client super(AtomicGCSFile, self).__init__(path) def move_to_final_destination(...
class AtomicGCSFile(luigi.target.AtomicLocalFile): ''' A GCS file that writes to a temp file and put to GCS on close. ''' def __init__(self, path, gcs_client): pass def move_to_final_destination(self): pass
3
1
3
0
3
0
1
0.5
1
1
0
0
2
1
2
9
11
2
6
4
3
3
6
4
3
1
1
0
2
17,718
spotify/luigi
spotify_luigi/luigi/contrib/gcs.py
luigi.contrib.gcs.GCSClient
import tempfile from io import BytesIO import luigi.target from luigi.contrib import gcp from urllib.parse import urlsplit import os import mimetypes class GCSClient(luigi.target.FileSystem): """An implementation of a FileSystem over Google Cloud Storage. There are several ways to use this class. By defaul...
class GCSClient(luigi.target.FileSystem): '''An implementation of a FileSystem over Google Cloud Storage. There are several ways to use this class. By default it will use the app default credentials, as described at https://developers.google.com/identity/protocols/application-default-credentials . ...
25
6
12
2
10
1
3
0.19
1
10
4
0
21
2
21
50
308
61
208
78
180
39
173
70
149
6
4
3
57
17,719
spotify/luigi
spotify_luigi/luigi/contrib/gcs.py
luigi.contrib.gcs.GCSFlagTarget
import luigi.target class GCSFlagTarget(GCSTarget): """ Defines a target directory with a flag-file (defaults to `_SUCCESS`) used to signify job success. This checks for two things: * the path exists (just like the GCSTarget) * the _SUCCESS file exists within the directory. Because Hadoo...
class GCSFlagTarget(GCSTarget): ''' Defines a target directory with a flag-file (defaults to `_SUCCESS`) used to signify job success. This checks for two things: * the path exists (just like the GCSTarget) * the _SUCCESS file exists within the directory. Because Hadoop outputs into a direct...
3
2
12
1
7
5
2
1.4
1
3
1
0
2
2
2
34
47
11
15
7
12
21
14
7
11
3
6
1
4
17,720
spotify/luigi
spotify_luigi/luigi/contrib/gcs.py
luigi.contrib.gcs.GCSTarget
import luigi.target import io from luigi.format import FileWrapper class GCSTarget(luigi.target.FileSystemTarget): fs = None def __init__(self, path, format=None, client=None): super(GCSTarget, self).__init__(path) if format is None: format = luigi.format.get_default_format() ...
class GCSTarget(luigi.target.FileSystemTarget): def __init__(self, path, format=None, client=None): pass def open(self, mode='r'): pass
3
0
8
1
7
0
3
0
1
5
3
1
2
1
2
32
19
3
16
5
13
0
13
5
10
3
5
1
5
17,721
spotify/luigi
spotify_luigi/luigi/contrib/gcs.py
luigi.contrib.gcs.InvalidDeleteException
import luigi.target class InvalidDeleteException(luigi.target.FileSystemException): pass
class InvalidDeleteException(luigi.target.FileSystemException): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
10
2
0
2
1
1
0
2
1
1
0
4
0
0
17,722
spotify/luigi
spotify_luigi/luigi/contrib/gcs.py
luigi.contrib.gcs._DeleteOnCloseFile
import os import io class _DeleteOnCloseFile(io.FileIO): def close(self): super(_DeleteOnCloseFile, self).close() try: os.remove(self.name) except OSError: pass def readable(self): return True def writable(self): return False def seeka...
class _DeleteOnCloseFile(io.FileIO): def close(self): pass def readable(self): pass def writable(self): pass def seekable(self): pass
5
0
4
0
3
1
1
0.15
0
2
0
0
4
0
4
4
18
3
13
5
8
2
13
5
8
2
0
1
5
17,723
spotify/luigi
spotify_luigi/luigi/contrib/hadoop.py
luigi.contrib.hadoop.BaseHadoopJobTask
import abc import luigi.contrib.s3 import luigi import luigi.contrib.hdfs import luigi.task import luigi.contrib.gcs from luigi import configuration class BaseHadoopJobTask(luigi.Task): pool = luigi.OptionalParameter(default=None, significant=False, positional=False) batch_counter_default = 1 final_mapper ...
class BaseHadoopJobTask(luigi.Task): def _get_pool(self): ''' Protected method ''' pass @abc.abstractmethod def job_runner(self): pass def jobconfs(self): pass def init_local(self): ''' Implement any work to setup any internal datastructure etc her...
14
3
6
1
4
1
2
0.29
1
3
2
4
12
3
12
90
101
22
62
30
48
18
54
29
41
5
5
2
19
17,724
spotify/luigi
spotify_luigi/luigi/contrib/hadoop.py
luigi.contrib.hadoop.DefaultHadoopJobRunner
from luigi import configuration class DefaultHadoopJobRunner(HadoopJobRunner): """ The default job runner just reads from config and sets stuff. """ def __init__(self): config = configuration.get_config() streaming_jar = config.get('hadoop', 'streaming-jar') super(DefaultHadoop...
class DefaultHadoopJobRunner(HadoopJobRunner): ''' The default job runner just reads from config and sets stuff. ''' def __init__(self): pass
2
1
4
0
4
0
1
0.6
1
1
0
0
1
0
1
5
9
1
5
4
3
3
5
4
3
1
2
0
1
17,725
spotify/luigi
spotify_luigi/luigi/contrib/hadoop.py
luigi.contrib.hadoop.HadoopJobError
class HadoopJobError(RuntimeError): def __init__(self, message, out=None, err=None): super(HadoopJobError, self).__init__(message, out, err) self.message = message self.out = out self.err = err def __str__(self): return self.message
class HadoopJobError(RuntimeError): def __init__(self, message, out=None, err=None): pass def __str__(self): pass
3
0
4
0
4
0
1
0
1
1
0
0
2
3
2
13
10
2
8
6
5
0
8
6
5
1
4
0
2
17,726
spotify/luigi
spotify_luigi/luigi/contrib/hadoop.py
luigi.contrib.hadoop.HadoopJobRunner
import tempfile import random import warnings import subprocess import shutil import luigi.contrib.s3 from luigi.contrib import mrrunner import luigi import os import luigi.contrib.hdfs import luigi.contrib.gcs import datetime from luigi import configuration import luigi.task class HadoopJobRunner(JobRunner): """ ...
class HadoopJobRunner(JobRunner): ''' Takes care of uploading & executing a Hadoop job using Hadoop streaming. TODO: add code to support Elastic Mapreduce (using boto) and local execution. ''' def __init__(self, streaming_jar, modules=None, streaming_args=None, libjars=None, libjars_in_hdfs=None, ...
6
1
38
7
29
3
7
0.13
1
9
4
1
4
11
4
4
197
38
143
52
134
18
116
49
110
30
1
2
35
17,727
spotify/luigi
spotify_luigi/luigi/contrib/hadoop.py
luigi.contrib.hadoop.HadoopRunContext
import sys import signal import subprocess class HadoopRunContext: def __init__(self): self.job_id = None self.application_id = None def __enter__(self): self.__old_signal = signal.getsignal(signal.SIGTERM) signal.signal(signal.SIGTERM, self.kill_job) return self ...
class HadoopRunContext: def __init__(self): pass def __enter__(self): pass def kill_job(self, captured_signal=None, stack_frame=None): pass def __exit__(self, exc_type, exc_val, exc_tb): pass
5
0
5
0
5
0
2
0.05
0
1
0
0
4
3
4
4
26
4
21
8
16
1
20
8
15
4
0
1
8
17,728
spotify/luigi
spotify_luigi/luigi/contrib/hadoop.py
luigi.contrib.hadoop.JobRunner
class JobRunner: run_job = NotImplemented
class JobRunner: pass
1
0
0
0
0
0
0
0
0
0
0
5
0
0
0
0
2
0
2
2
1
0
2
2
1
0
0
0
0
17,729
spotify/luigi
spotify_luigi/luigi/contrib/hadoop.py
luigi.contrib.hadoop.JobTask
import luigi.contrib.hdfs import pickle import luigi import luigi.contrib.gcs import luigi.contrib.s3 import luigi.task import os import sys import warnings from itertools import groupby class JobTask(BaseHadoopJobTask): jobconf_truncate = 20000 n_reduce_tasks = 25 reducer = NotImplemented def jobconf...
class JobTask(BaseHadoopJobTask): def jobconfs(self): pass def init_mapper(self): pass def init_combiner(self): pass def init_reducer(self): pass def _setup_remote(self): pass def job_runner(self): ''' Get the MapReduce runner for th...
27
17
9
1
6
3
2
0.48
1
10
3
6
26
2
26
116
273
40
158
63
131
76
149
62
122
8
6
4
59
17,730
spotify/luigi
spotify_luigi/luigi/contrib/hadoop.py
luigi.contrib.hadoop.LocalJobRunner
import luigi.contrib.hdfs import luigi import luigi.task import luigi.contrib.gcs from io import StringIO import luigi.contrib.s3 import hashlib class LocalJobRunner(JobRunner): """ Will run the job locally. This is useful for debugging and also unit testing. Tries to mimic Hadoop Streaming. TODO: in...
class LocalJobRunner(JobRunner): ''' Will run the job locally. This is useful for debugging and also unit testing. Tries to mimic Hadoop Streaming. TODO: integrate with JobTask ''' def __init__(self, samplelines=None): pass def sample(self, input_stream, n, output): pass ...
5
1
13
2
11
1
3
0.19
1
2
0
0
4
1
4
4
62
12
43
20
38
8
42
20
37
4
1
2
11
17,731
spotify/luigi
spotify_luigi/luigi/contrib/hadoop.py
luigi.contrib.hadoop.hadoop
import luigi import luigi.task import luigi.contrib.hdfs import luigi.contrib.s3 import luigi.contrib.gcs class hadoop(luigi.task.Config): pool = luigi.OptionalParameter(default=None, description='Hadoop pool so use for Hadoop tasks. To specify pools per tasks, see BaseHadoopJobTask.pool')
class hadoop(luigi.task.Config): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
78
8
0
8
2
7
0
2
2
1
0
6
0
0
17,732
spotify/luigi
spotify_luigi/luigi/contrib/hadoop_jar.py
luigi.contrib.hadoop_jar.HadoopJarJobError
class HadoopJarJobError(Exception): pass
class HadoopJarJobError(Exception): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
10
2
0
2
1
1
0
2
1
1
0
3
0
0
17,733
spotify/luigi
spotify_luigi/luigi/contrib/hadoop_jar.py
luigi.contrib.hadoop_jar.HadoopJarJobRunner
import luigi.contrib.hadoop import shlex import warnings import luigi.contrib.hdfs import os class HadoopJarJobRunner(luigi.contrib.hadoop.JobRunner): """ JobRunner for `hadoop jar` commands. Used to run a HadoopJarJobTask. """ def __init__(self): pass def run_job(self, job, tracking_url_...
class HadoopJarJobRunner(luigi.contrib.hadoop.JobRunner): ''' JobRunner for `hadoop jar` commands. Used to run a HadoopJarJobTask. ''' def __init__(self): pass def run_job(self, job, tracking_url_callback=None): pass
3
1
26
5
20
2
6
0.15
1
2
1
0
2
0
2
2
57
11
41
13
38
6
36
13
33
10
1
2
11
17,734
spotify/luigi
spotify_luigi/luigi/contrib/hadoop_jar.py
luigi.contrib.hadoop_jar.HadoopJarJobTask
import luigi.contrib.hdfs import luigi.contrib.hadoop class HadoopJarJobTask(luigi.contrib.hadoop.BaseHadoopJobTask): """ A job task for `hadoop jar` commands that define a jar and (optional) main method. """ def jar(self): """ Path to the jar for this Hadoop Job. """ r...
class HadoopJarJobTask(luigi.contrib.hadoop.BaseHadoopJobTask): ''' A job task for `hadoop jar` commands that define a jar and (optional) main method. ''' def jar(self): ''' Path to the jar for this Hadoop Job. ''' pass def main(self): ''' optio...
7
6
5
0
2
3
1
1.62
1
1
1
4
6
0
6
96
40
6
13
7
6
21
13
7
6
1
6
0
6
17,735
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/abstract_client.py
luigi.contrib.hdfs.abstract_client.HdfsFileSystem
import abc import luigi.target class HdfsFileSystem(luigi.target.FileSystem, metaclass=abc.ABCMeta): """ This client uses Apache 2.x syntax for file system commands, which also matched CDH4. """ def rename(self, path, dest): """ Rename or move a file. In hdfs land, "mv" is oft...
class HdfsFileSystem(luigi.target.FileSystem, metaclass=abc.ABCMeta): ''' This client uses Apache 2.x syntax for file system commands, which also matched CDH4. ''' def rename(self, path, dest): ''' Rename or move a file. In hdfs land, "mv" is often called rename. So we add an a...
23
4
4
0
2
2
1
0.61
2
1
0
2
12
0
12
41
72
14
36
24
12
22
25
13
12
1
4
0
12
17,736
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/config.py
luigi.contrib.hdfs.config.hadoopcli
import luigi import luigi.configuration class hadoopcli(luigi.Config): command = luigi.Parameter(default='hadoop', config_path=dict(section='hadoop', name='command'), description='The hadoop command, will run split() on it, so you can pass something like "hadoop --param"') version = luigi.Parameter(default='cd...
class hadoopcli(luigi.Config): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
78
8
0
8
3
7
0
3
3
2
0
6
0
0
17,737
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/config.py
luigi.contrib.hdfs.config.hdfs
import luigi import luigi.configuration class hdfs(luigi.Config): client_version = luigi.IntParameter(default=None) namenode_host = luigi.OptionalParameter(default=None) namenode_port = luigi.IntParameter(default=None) client = luigi.Parameter(default='hadoopcli') tmp_dir = luigi.OptionalParameter(...
class hdfs(luigi.Config): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
78
9
0
9
6
8
0
6
6
5
0
6
0
0
17,738
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/error.py
luigi.contrib.hdfs.error.HDFSCliError
class HDFSCliError(Exception): def __init__(self, command, returncode, stdout, stderr): self.returncode = returncode self.stdout = stdout self.stderr = stderr msg = 'Command %r failed [exit code %d]\n---stdout---\n%s\n---stderr---\n%s------------' % (command, returncode, stdout, std...
class HDFSCliError(Exception): def __init__(self, command, returncode, stdout, stderr): pass
2
0
11
0
11
0
1
0
1
1
0
0
1
3
1
11
13
1
12
6
10
0
7
6
5
1
3
0
1
17,739
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/format.py
luigi.contrib.hdfs.format.CompatibleHdfsFormat
import luigi.format class CompatibleHdfsFormat(luigi.format.Format): output = 'hdfs' def __init__(self, writer, reader, input=None): if input is not None: self.input = input self.reader = reader self.writer = writer def pipe_writer(self, output): return self.wr...
class CompatibleHdfsFormat(luigi.format.Format): def __init__(self, writer, reader, input=None): pass def pipe_writer(self, output): pass def pipe_reader(self, input): pass def hdfs_writer(self, output): pass def hdfs_reader(self, input): pass def _...
8
0
5
0
4
0
2
0.15
1
2
0
0
7
4
7
10
47
10
33
19
25
5
33
19
25
3
1
2
12
17,740
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/format.py
luigi.contrib.hdfs.format.HdfsAtomicWriteDirPipe
from luigi.contrib.hdfs import config as hdfs_config from luigi.contrib.hdfs.config import load_hadoop_cmd from luigi.contrib.hdfs.error import HDFSCliError from luigi.contrib.hdfs.clients import remove, rename, mkdir, listdir, exists import os import luigi.format class HdfsAtomicWriteDirPipe(luigi.format.OutputPipePr...
class HdfsAtomicWriteDirPipe(luigi.format.OutputPipeProcessWrapper): ''' Writes a data<data_extension> file to a directory at <path>. ''' def __init__(self, path, data_extension=''): pass def abort(self): pass def close(self): pass
4
1
9
1
8
0
3
0.15
1
5
2
0
3
3
3
16
35
5
26
8
22
4
24
7
20
6
1
2
8
17,741
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/format.py
luigi.contrib.hdfs.format.HdfsAtomicWriteError
class HdfsAtomicWriteError(IOError): pass
class HdfsAtomicWriteError(IOError): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
2
0
2
1
1
0
2
1
1
0
1
0
0
17,742
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/format.py
luigi.contrib.hdfs.format.HdfsAtomicWritePipe
from luigi.contrib.hdfs.error import HDFSCliError from luigi.contrib.hdfs.clients import remove, rename, mkdir, listdir, exists from luigi.contrib.hdfs import config as hdfs_config import os from luigi.contrib.hdfs.config import load_hadoop_cmd import luigi.format class HdfsAtomicWritePipe(luigi.format.OutputPipeProce...
class HdfsAtomicWritePipe(luigi.format.OutputPipeProcessWrapper): ''' File like object for writing to HDFS The referenced file is first written to a temporary location and then renamed to final location on close(). If close() isn't called the temporary file will be cleaned up when this object is ...
4
1
8
0
8
0
2
0.38
1
4
2
0
3
2
3
16
38
5
24
8
20
9
22
7
18
5
1
2
7
17,743
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/format.py
luigi.contrib.hdfs.format.HdfsReadPipe
from luigi.contrib.hdfs.config import load_hadoop_cmd import luigi.format class HdfsReadPipe(luigi.format.InputPipeProcessWrapper): def __init__(self, path): super(HdfsReadPipe, self).__init__(load_hadoop_cmd() + ['fs', '-cat', path])
class HdfsReadPipe(luigi.format.InputPipeProcessWrapper): def __init__(self, path): pass
2
0
2
0
2
0
1
0
1
1
0
0
1
0
1
14
4
1
3
2
1
0
3
2
1
1
1
0
1
17,744
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/format.py
luigi.contrib.hdfs.format.PlainDirFormat
import luigi.format class PlainDirFormat(luigi.format.Format): input = 'bytes' output = 'hdfs' def hdfs_writer(self, path): return self.pipe_writer(path) def hdfs_reader(self, path): return self.pipe_reader(path) def pipe_reader(self, path): return HdfsReadPipe('%s/[^_]*'...
class PlainDirFormat(luigi.format.Format): def hdfs_writer(self, path): pass def hdfs_reader(self, path): pass def pipe_reader(self, path): pass def pipe_writer(self, path): pass
5
0
2
0
2
0
1
0.09
1
2
2
0
4
0
4
7
17
5
11
6
6
1
11
6
6
1
1
0
4
17,745
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/format.py
luigi.contrib.hdfs.format.PlainFormat
import luigi.format class PlainFormat(luigi.format.Format): input = 'bytes' output = 'hdfs' def hdfs_writer(self, path): return self.pipe_writer(path) def hdfs_reader(self, path): return self.pipe_reader(path) def pipe_reader(self, path): return HdfsReadPipe(path) de...
class PlainFormat(luigi.format.Format): def hdfs_writer(self, path): pass def hdfs_reader(self, path): pass def pipe_reader(self, path): pass def pipe_writer(self, output_pipe): pass
5
0
2
0
2
0
1
0
1
2
2
0
4
0
4
7
16
5
11
6
6
0
11
6
6
1
1
0
4
17,746
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/hadoopcli_clients.py
luigi.contrib.hdfs.hadoopcli_clients.HdfsClient
import warnings from luigi.contrib.hdfs import abstract_client as hdfs_abstract_client from luigi.target import FileAlreadyExists from luigi.contrib.hdfs import error as hdfs_error import datetime from luigi.contrib.hdfs.config import load_hadoop_cmd import re import os import subprocess class HdfsClient(hdfs_abstract...
class HdfsClient(hdfs_abstract_client.HdfsFileSystem): ''' This client uses Apache 2.x syntax for file system commands, which also matched CDH4. ''' @staticmethod def call_check(command): pass def exists(self, path): ''' Use ``hadoop fs -stat`` to check file existence. ...
16
2
10
1
9
0
3
0.06
1
8
2
1
13
0
14
55
162
23
133
50
116
8
115
47
100
12
5
3
45
17,747
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/hadoopcli_clients.py
luigi.contrib.hdfs.hadoopcli_clients.HdfsClientApache1
import subprocess from luigi.contrib.hdfs.config import load_hadoop_cmd from luigi.contrib.hdfs import error as hdfs_error class HdfsClientApache1(HdfsClientCdh3): """ This client uses Apache 1.x syntax for file system commands, which are similar to CDH3 except for the file existence check. """ rec...
class HdfsClientApache1(HdfsClientCdh3): ''' This client uses Apache 1.x syntax for file system commands, which are similar to CDH3 except for the file existence check. ''' def exists(self, path): pass
2
1
10
0
10
0
3
0.33
1
2
1
0
1
0
1
58
18
2
12
6
10
4
10
6
8
3
7
1
3
17,748
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/hadoopcli_clients.py
luigi.contrib.hdfs.hadoopcli_clients.HdfsClientCdh3
from luigi.contrib.hdfs import error as hdfs_error from luigi.target import FileAlreadyExists from luigi.contrib.hdfs.config import load_hadoop_cmd class HdfsClientCdh3(HdfsClient): """ This client uses CDH3 syntax for file system commands. """ def mkdir(self, path, parents=True, raise_if_exists=False...
class HdfsClientCdh3(HdfsClient): ''' This client uses CDH3 syntax for file system commands. ''' def mkdir(self, path, parents=True, raise_if_exists=False): ''' No explicit -p switch, this version of Hadoop always creates parent directories. ''' pass def remove(sel...
3
2
12
1
9
2
4
0.32
1
2
2
1
2
0
2
57
29
4
19
5
16
6
17
4
14
4
6
3
7
17,749
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/target.py
luigi.contrib.hdfs.target.HdfsFlagTarget
from luigi.contrib.hdfs import format as hdfs_format class HdfsFlagTarget(HdfsTarget): """ Defines a target directory with a flag-file (defaults to `_SUCCESS`) used to signify job success. This checks for two things: * the path exists (just like the HdfsTarget) * the _SUCCESS file exists with...
class HdfsFlagTarget(HdfsTarget): ''' Defines a target directory with a flag-file (defaults to `_SUCCESS`) used to signify job success. This checks for two things: * the path exists (just like the HdfsTarget) * the _SUCCESS file exists within the directory. Because Hadoop outputs into a dir...
3
2
10
1
5
5
2
1.8
1
2
0
0
2
1
2
44
33
5
10
5
7
18
9
5
6
2
6
1
3
17,750
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/target.py
luigi.contrib.hdfs.target.HdfsTarget
import warnings from luigi.contrib.hdfs.config import tmppath import luigi from luigi.contrib.hdfs import clients as hdfs_clients from luigi.target import FileSystemTarget from urllib import parse as urlparse import random from luigi.contrib.hdfs import format as hdfs_format class HdfsTarget(FileSystemTarget): de...
class HdfsTarget(FileSystemTarget): def __init__(self, path=None, format=None, is_tmp=False, fs=None): pass def __del__(self): pass @property def fs(self): pass def glob_exists(self, expected_files): pass def open(self, mode='r'): pass def remove...
14
5
12
1
8
2
3
0.27
1
7
1
1
12
4
12
42
156
26
102
30
88
28
78
28
65
8
5
4
30
17,751
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/webhdfs_client.py
luigi.contrib.hdfs.webhdfs_client.WebHdfsClient
from luigi.contrib.hdfs import config as hdfs_config from luigi.contrib.hdfs import abstract_client as hdfs_abstract_client import os import warnings class WebHdfsClient(hdfs_abstract_client.HdfsFileSystem): """ A webhdfs that tries to confirm to luigis interface for file existence. The library is using `...
class WebHdfsClient(hdfs_abstract_client.HdfsFileSystem): ''' A webhdfs that tries to confirm to luigis interface for file existence. The library is using `this api <https://hdfscli.readthedocs.io/en/latest/api.html>`__. ''' def __init__(self, host=None, port=None, user=None, client_type=None)...
22
10
6
0
4
2
1
0.55
1
5
2
0
19
4
19
60
134
20
75
38
47
41
65
32
42
3
5
2
25
17,752
spotify/luigi
spotify_luigi/luigi/contrib/hdfs/webhdfs_client.py
luigi.contrib.hdfs.webhdfs_client.webhdfs
import luigi.contrib.target class webhdfs(luigi.Config): port = luigi.IntParameter(default=50070, description='Port for webhdfs') user = luigi.Parameter(default='', description='Defaults to $USER envvar', config_path=dict(section='hdfs', name='user')) client_type = luigi.ChoiceParameter(var_type=str, choic...
class webhdfs(luigi.Config): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
78
7
0
7
4
6
0
4
4
3
0
6
0
0
17,753
spotify/luigi
spotify_luigi/luigi/contrib/hive.py
luigi.contrib.hive.ApacheHiveCommandClient
class ApacheHiveCommandClient(HiveCommandClient): """ A subclass for the HiveCommandClient to (in some cases) ignore the return code from the hive command so that we can just parse the output. """ def table_schema(self, table, database='default'): describe = run_hive_cmd('use {0}; describe ...
class ApacheHiveCommandClient(HiveCommandClient): ''' A subclass for the HiveCommandClient to (in some cases) ignore the return code from the hive command so that we can just parse the output. ''' def table_schema(self, table, database='default'): pass
2
1
5
0
5
0
2
0.67
1
1
0
0
1
0
1
29
11
1
6
3
4
4
6
3
4
2
5
1
2
17,754
spotify/luigi
spotify_luigi/luigi/contrib/hive.py
luigi.contrib.hive.ExternalHiveTask
import luigi import luigi.contrib.hadoop class ExternalHiveTask(luigi.ExternalTask): """ External task that depends on a Hive table/partition. """ database = luigi.Parameter(default='default') table = luigi.Parameter() partition = luigi.DictParameter(default={}, description='Python dictionary s...
class ExternalHiveTask(luigi.ExternalTask): ''' External task that depends on a Hive table/partition. ''' def output(self): pass
2
1
6
0
6
0
1
0.23
1
1
1
2
1
0
1
79
17
1
13
5
11
3
6
5
4
1
6
0
1
17,755
spotify/luigi
spotify_luigi/luigi/contrib/hive.py
luigi.contrib.hive.HiveClient
import abc class HiveClient(metaclass=abc.ABCMeta): @abc.abstractmethod def table_location(self, table, database='default', partition=None): """ Returns location of db.table (or db.table.partition). partition is a dict of partition key to value. """ pass @abc.abstr...
class HiveClient(metaclass=abc.ABCMeta): @abc.abstractmethod def table_location(self, table, database='default', partition=None): ''' Returns location of db.table (or db.table.partition). partition is a dict of partition key to value. ''' pass @abc.abstractmethod ...
9
4
5
0
2
3
1
0.92
1
0
0
3
4
0
4
24
29
4
13
9
4
12
9
5
4
1
3
0
4
17,756
spotify/luigi
spotify_luigi/luigi/contrib/hive.py
luigi.contrib.hive.HiveCommandClient
import operator class HiveCommandClient(HiveClient): """ Uses `hive` invocations to find information. """ def table_location(self, table, database='default', partition=None): cmd = 'use {0}; describe formatted {1}'.format(database, table) if partition is not None: cmd += ' ...
class HiveCommandClient(HiveClient): ''' Uses `hive` invocations to find information. ''' def table_location(self, table, database='default', partition=None): pass def table_exists(self, table, database='default', partition=None): pass def table_schema(self, table, database='...
5
2
9
1
7
1
3
0.21
1
2
0
1
4
0
4
28
42
8
28
10
23
6
24
10
19
4
4
2
10
17,757
spotify/luigi
spotify_luigi/luigi/contrib/hive.py
luigi.contrib.hive.HiveCommandError
class HiveCommandError(RuntimeError): def __init__(self, message, out=None, err=None): super(HiveCommandError, self).__init__(message, out, err) self.message = message self.out = out self.err = err
class HiveCommandError(RuntimeError): def __init__(self, message, out=None, err=None): pass
2
0
5
0
5
0
1
0
1
1
0
0
1
3
1
12
7
1
6
5
4
0
6
5
4
1
4
0
1
17,758
spotify/luigi
spotify_luigi/luigi/contrib/hive.py
luigi.contrib.hive.HivePartitionTarget
import luigi import luigi.contrib.hadoop class HivePartitionTarget(luigi.Target): """ Target representing Hive table or Hive partition """ def __init__(self, table, partition, database='default', fail_missing_table=True, client=None): """ @param table: Table name @type table: s...
class HivePartitionTarget(luigi.Target): ''' Target representing Hive table or Hive partition ''' def __init__(self, table, partition, database='default', fail_missing_table=True, client=None): ''' @param table: Table name @type table: str @param partition: partition sp...
6
4
13
0
8
5
2
0.64
1
3
1
1
4
5
4
25
59
5
33
12
27
21
24
11
19
4
4
3
8
17,759
spotify/luigi
spotify_luigi/luigi/contrib/hive.py
luigi.contrib.hive.HiveQueryRunner
import warnings import os from luigi.task import flatten import tempfile import luigi import luigi.contrib.hadoop from luigi.target import FileAlreadyExists, FileSystemTarget class HiveQueryRunner(luigi.contrib.hadoop.JobRunner): """ Runs a HiveQueryTask by shelling out to hive. """ def prepare_output...
class HiveQueryRunner(luigi.contrib.hadoop.JobRunner): ''' Runs a HiveQueryTask by shelling out to hive. ''' def prepare_outputs(self, job): ''' Called before job is started. If output is a `FileSystemTarget`, create parent directories so the hive command won't fail '''...
4
2
17
1
14
2
5
0.21
1
4
2
0
3
0
3
3
57
5
43
16
39
9
42
15
38
8
1
4
16
17,760
spotify/luigi
spotify_luigi/luigi/contrib/hive.py
luigi.contrib.hive.HiveQueryTask
import luigi.contrib.hadoop import abc import luigi class HiveQueryTask(luigi.contrib.hadoop.BaseHadoopJobTask): """ Task to run a hive query. """ n_reduce_tasks = None bytes_per_reducer = None reducers_max = None @abc.abstractmethod def query(self): """ Text of query to run in...
class HiveQueryTask(luigi.contrib.hadoop.BaseHadoopJobTask): ''' Task to run a hive query. ''' @abc.abstractmethod def query(self): ''' Text of query to run in hive ''' pass def hiverc(self): ''' Location of an rc file to run before the query if hiverc-l...
7
5
10
0
5
5
2
0.93
1
2
1
1
5
0
5
95
64
8
29
12
22
27
27
11
21
7
6
2
11
17,761
spotify/luigi
spotify_luigi/luigi/contrib/hive.py
luigi.contrib.hive.HiveTableTarget
class HiveTableTarget(HivePartitionTarget): """ Target representing non-partitioned table """ def __init__(self, table, database='default', client=None): super(HiveTableTarget, self).__init__(table=table, partition=None, database=database, fail_missing_table=False, client=client)
class HiveTableTarget(HivePartitionTarget): ''' Target representing non-partitioned table ''' def __init__(self, table, database='default', client=None): pass
2
1
8
0
8
0
1
0.33
1
1
0
0
1
0
1
26
13
1
9
2
7
3
3
2
1
1
5
0
1
17,762
spotify/luigi
spotify_luigi/luigi/contrib/hive.py
luigi.contrib.hive.HiveThriftContext
import luigi.contrib.hadoop import luigi class HiveThriftContext: """ Context manager for hive metastore client. """ def __enter__(self): try: from thrift.transport import TSocket from thrift.transport import TTransport from thrift.protocol import TBinaryPro...
class HiveThriftContext: ''' Context manager for hive metastore client. ''' def __enter__(self): pass def __exit__(self, exc_type, exc_val, exc_tb): pass
3
1
11
0
10
2
2
0.3
0
3
0
0
2
1
2
2
28
2
20
14
13
6
20
13
13
2
0
1
3
17,763
spotify/luigi
spotify_luigi/luigi/contrib/hive.py
luigi.contrib.hive.MetastoreClient
import operator class MetastoreClient(HiveClient): def table_location(self, table, database='default', partition=None): with HiveThriftContext() as client: if partition is not None: try: import hive_metastore.ttypes partition_str = self.p...
class MetastoreClient(HiveClient): def table_location(self, table, database='default', partition=None): pass def table_exists(self, table, database='default', partition=None): pass def _existing_partitions(self, table, database, client): pass def _parse_partition_string(...
7
0
7
0
6
0
2
0.03
1
2
1
0
5
0
5
29
40
6
33
17
25
1
31
14
23
3
4
3
10
17,764
spotify/luigi
spotify_luigi/luigi/contrib/hive.py
luigi.contrib.hive.WarehouseHiveClient
import re import os from luigi.contrib.hdfs import get_autoconfig_client class WarehouseHiveClient(HiveClient): """ Client for managed tables that makes decision based on presence of directory in hdfs """ def __init__(self, hdfs_client=None, warehouse_location=None): self.hdfs_client = hdfs_cl...
class WarehouseHiveClient(HiveClient): ''' Client for managed tables that makes decision based on presence of directory in hdfs ''' def __init__(self, hdfs_client=None, warehouse_location=None): pass def table_schema(self, table, database='default'): pass def table_location(s...
6
2
7
0
6
1
2
0.23
1
0
0
0
5
2
5
29
44
7
30
13
24
7
23
13
17
5
4
3
9
17,765
spotify/luigi
spotify_luigi/luigi/contrib/kubernetes.py
luigi.contrib.kubernetes.KubernetesJobTask
from datetime import datetime import luigi import time import uuid class KubernetesJobTask(luigi.Task): __DEFAULT_POLL_INTERVAL = 5 __DEFAULT_POD_CREATION_INTERVAL = 5 _kubernetes_config = None def _init_kubernetes(self): self.__logger = logger self.__logger.debug('Kubernetes auth meth...
class KubernetesJobTask(luigi.Task): def _init_kubernetes(self): pass @property def auth_method(self): ''' This can be set to ``kubeconfig`` or ``service-account``. It defaults to ``kubeconfig``. For more details, please refer to: - kubeconfig: http://kubern...
41
18
11
1
7
4
2
0.5
1
5
1
3
26
4
26
104
337
51
193
70
152
96
142
56
115
9
5
4
53
17,766
spotify/luigi
spotify_luigi/luigi/contrib/kubernetes.py
luigi.contrib.kubernetes.kubernetes
import luigi class kubernetes(luigi.Config): auth_method = luigi.Parameter(default='kubeconfig', description='Authorization method to access the cluster') kubeconfig_path = luigi.Parameter(default='~/.kube/config', description='Path to kubeconfig file for cluster authentication') max_retrials = luigi.IntPa...
class kubernetes(luigi.Config): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
78
13
0
13
5
12
0
5
5
4
0
6
0
0
17,767
spotify/luigi
spotify_luigi/luigi/contrib/lsf.py
luigi.contrib.lsf.LSFJobTask
import sys import time import shutil import luigi import luigi.configuration from luigi.contrib import lsf_runner import subprocess import os from luigi.contrib.hadoop import create_packages_archive import random from luigi.task_status import PENDING, FAILED, DONE, RUNNING, UNKNOWN class LSFJobTask(luigi.Task): ""...
class LSFJobTask(luigi.Task): ''' Takes care of uploading and executing an LSF job ''' def fetch_task_failures(self): ''' Read in the error file from bsub ''' pass def fetch_task_output(self): ''' Read in the output file ''' pass ...
12
8
20
2
12
6
3
0.44
1
4
0
2
11
3
11
89
248
37
149
50
137
65
127
48
115
10
5
4
28
17,768
spotify/luigi
spotify_luigi/luigi/contrib/lsf.py
luigi.contrib.lsf.LocalLSFJobTask
class LocalLSFJobTask(LSFJobTask): """ A local version of JobTask, for easier debugging. """ def run(self): self.init_local() self.work()
class LocalLSFJobTask(LSFJobTask): ''' A local version of JobTask, for easier debugging. ''' def run(self): pass
2
1
3
0
3
0
1
0.75
1
0
0
0
1
0
1
90
8
1
4
2
2
3
4
2
2
1
6
0
1
17,769
spotify/luigi
spotify_luigi/luigi/contrib/mongodb.py
luigi.contrib.mongodb.MongoCellTarget
class MongoCellTarget(MongoTarget): """ Target for a ressource in a specific field from a MongoDB document """ def __init__(self, mongo_client, index, collection, document_id, path): """ :param document_id: targeted mongo document :type document_id: str :param path: full path to...
class MongoCellTarget(MongoTarget): ''' Target for a ressource in a specific field from a MongoDB document ''' def __init__(self, mongo_client, index, collection, document_id, path): ''' :param document_id: targeted mongo document :type document_id: str :param path: full path to...
5
5
10
1
5
4
2
0.82
1
1
0
0
4
2
4
29
48
8
22
9
17
18
15
9
10
3
5
2
6
17,770
spotify/luigi
spotify_luigi/luigi/contrib/mongodb.py
luigi.contrib.mongodb.MongoCollectionTarget
class MongoCollectionTarget(MongoTarget): """ Target for existing collection """ def __init__(self, mongo_client, index, collection): super(MongoCollectionTarget, self).__init__(mongo_client, index, collection) def exists(self): """ Test if target has been run Target is con...
class MongoCollectionTarget(MongoTarget): ''' Target for existing collection ''' def __init__(self, mongo_client, index, collection): pass def exists(self): ''' Test if target has been run Target is considered run if the targeted collection exists in the database ''...
4
3
4
0
2
2
1
1.14
1
1
0
0
3
1
3
28
19
4
7
5
3
8
7
4
3
1
5
0
3
17,771
spotify/luigi
spotify_luigi/luigi/contrib/mongodb.py
luigi.contrib.mongodb.MongoCountTarget
class MongoCountTarget(MongoTarget): """ Target for documents count """ def __init__(self, mongo_client, index, collection, target_count): """ :param target_count: Value of the desired item count in the target :type field: int """ super(MongoCountTarget, self).__init__(m...
class MongoCountTarget(MongoTarget): ''' Target for documents count ''' def __init__(self, mongo_client, index, collection, target_count): ''' :param target_count: Value of the desired item count in the target :type field: int ''' pass def exists(self): ''' ...
4
4
7
0
3
4
1
1.3
1
1
0
0
3
1
3
28
28
5
10
6
6
13
10
6
6
2
5
1
4
17,772
spotify/luigi
spotify_luigi/luigi/contrib/mongodb.py
luigi.contrib.mongodb.MongoRangeTarget
class MongoRangeTarget(MongoTarget): """ Target for a level 0 field in a range of documents """ def __init__(self, mongo_client, index, collection, document_ids, field): """ :param document_ids: targeted mongo documents :type documents_ids: list of str :param field: targeted fie...
class MongoRangeTarget(MongoTarget): ''' Target for a level 0 field in a range of documents ''' def __init__(self, mongo_client, index, collection, document_ids, field): ''' :param document_ids: targeted mongo documents :type documents_ids: list of str :param field: targeted fie...
6
6
12
1
7
4
1
0.65
1
2
0
0
5
2
5
30
68
12
34
12
28
22
21
12
15
3
5
1
7
17,773
spotify/luigi
spotify_luigi/luigi/contrib/mongodb.py
luigi.contrib.mongodb.MongoTarget
from luigi.target import Target class MongoTarget(Target): """ Target for a resource in MongoDB """ def __init__(self, mongo_client, index, collection): """ :param mongo_client: MongoClient instance :type mongo_client: MongoClient :param index: database index :type inde...
class MongoTarget(Target): ''' Target for a resource in MongoDB ''' def __init__(self, mongo_client, index, collection): ''' :param mongo_client: MongoClient instance :type mongo_client: MongoClient :param index: database index :type index: str :param collection...
5
4
6
0
3
4
1
1.25
1
0
0
4
4
3
4
25
32
5
12
9
7
15
12
9
7
1
4
0
4
17,774
spotify/luigi
spotify_luigi/luigi/contrib/mrrunner.py
luigi.contrib.mrrunner.Runner
import sys import tarfile import pickle import os class Runner: """ Run the mapper, combiner, or reducer on hadoop nodes. """ def __init__(self, job=None): self.extract_packages_archive() self.job = job or pickle.load(open('job-instance.pickle', 'rb')) self.job._setup_remote() ...
class Runner: ''' Run the mapper, combiner, or reducer on hadoop nodes. ''' def __init__(self, job=None): pass def run(self, kind, stdin=sys.stdin, stdout=sys.stdout): pass def extract_packages_archive(self): pass
4
1
8
0
7
0
3
0.13
0
1
0
0
3
1
3
3
30
4
23
7
19
3
20
7
16
4
0
1
9
17,775
spotify/luigi
spotify_luigi/luigi/contrib/mssqldb.py
luigi.contrib.mssqldb.MSSqlTarget
import luigi class MSSqlTarget(luigi.Target): """ Target for a resource in Microsoft SQL Server. This module is primarily derived from mysqldb.py. Much of MSSqlTarget, MySqlTarget and PostgresTarget are similar enough to potentially add a RDBMSTarget abstract base class to rdbms.py that these clas...
null
7
5
18
1
12
5
2
0.46
1
1
0
0
6
7
6
27
127
13
78
19
71
36
43
17
36
4
4
2
13
17,776
spotify/luigi
spotify_luigi/luigi/contrib/mysqldb.py
luigi.contrib.mysqldb.CopyToTable
from luigi.contrib import rdbms class CopyToTable(rdbms.CopyToTable): """ Template task for inserting a data set into MySQL Usage: Subclass and override the required `host`, `database`, `user`, `password`, `table` and `columns` attributes. To customize how to access data from an input task, o...
class CopyToTable(rdbms.CopyToTable): ''' Template task for inserting a data set into MySQL Usage: Subclass and override the required `host`, `database`, `user`, `password`, `table` and `columns` attributes. To customize how to access data from an input task, override the `rows` method with...
7
4
16
2
10
4
3
0.52
1
4
1
1
5
5
5
103
97
18
52
23
45
27
43
15
37
6
6
3
13
17,777
spotify/luigi
spotify_luigi/luigi/contrib/mysqldb.py
luigi.contrib.mysqldb.MySqlTarget
import luigi class MySqlTarget(luigi.Target): """ Target for a resource in MySql. """ marker_table = luigi.configuration.get_config().get('mysql', 'marker-table', 'table_updates') def __init__(self, host, database, user, password, table, update_id, **cnx_kwargs): """ Initializes a ...
null
7
4
18
1
13
5
2
0.38
1
1
0
0
6
8
6
27
121
12
80
22
73
30
49
20
42
4
4
2
13
17,778
spotify/luigi
spotify_luigi/luigi/contrib/opener.py
luigi.contrib.opener.InvalidQuery
class InvalidQuery(OpenerError): """Thrown when an opener is passed unexpected arguments""" pass
class InvalidQuery(OpenerError): '''Thrown when an opener is passed unexpected arguments''' pass
1
1
0
0
0
0
0
0.5
1
0
0
0
0
0
0
10
4
1
2
1
1
1
2
1
1
0
5
0
0
17,779
spotify/luigi
spotify_luigi/luigi/contrib/opener.py
luigi.contrib.opener.LocalOpener
from luigi.local_target import LocalTarget class LocalOpener(Opener): """Local filesystem opener, works with any valid system path. This is the default opener and will be used if you don't indicate which opener. examples: * file://relative/foo/bar/baz.txt (opens a relative file) * file:///home/use...
class LocalOpener(Opener): '''Local filesystem opener, works with any valid system path. This is the default opener and will be used if you don't indicate which opener. examples: * file://relative/foo/bar/baz.txt (opens a relative file) * file:///home/user (opens a directory from a absolute path) ...
3
1
5
0
5
0
1
0.58
1
1
1
0
0
0
1
3
23
4
12
7
8
7
7
5
5
1
1
0
1
17,780
spotify/luigi
spotify_luigi/luigi/contrib/opener.py
luigi.contrib.opener.MockOpener
from luigi.mock import MockTarget class MockOpener(Opener): """Mock target opener, works like LocalTarget but files are all in memory. example: * mock://foo/bar.txt """ names = ['mock'] allowed_kwargs = {'is_tmp': True, 'mirror_on_stderr': True, 'format': False} @classmethod def ...
class MockOpener(Opener): '''Mock target opener, works like LocalTarget but files are all in memory. example: * mock://foo/bar.txt ''' @classmethod def get_target(cls, scheme, path, fragment, username, password, hostname, port, query, **kwargs):
3
1
5
0
5
0
1
0.38
1
1
1
0
0
0
1
3
22
4
13
7
9
5
7
5
5
1
1
0
1
17,781
spotify/luigi
spotify_luigi/luigi/contrib/opener.py
luigi.contrib.opener.NoOpenerError
class NoOpenerError(OpenerError): """Thrown when there is no opener for the given protocol""" pass
class NoOpenerError(OpenerError): '''Thrown when there is no opener for the given protocol''' pass
1
1
0
0
0
0
0
0.5
1
0
0
0
0
0
0
10
4
1
2
1
1
1
2
1
1
0
5
0
0
17,782
spotify/luigi
spotify_luigi/luigi/contrib/opener.py
luigi.contrib.opener.Opener
import json from urllib.parse import urlsplit, parse_qs class Opener: """Base class for Opener objects. """ allowed_kwargs = {} filter_kwargs = True @classmethod def conform_query(cls, query): """Converts the query string from a target uri, uses cls.allowed_kwargs, and cls.fil...
class Opener: '''Base class for Opener objects. ''' @classmethod 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.un...
5
3
17
4
7
7
3
0.89
0
1
0
3
0
0
2
2
48
12
19
10
13
17
15
7
12
4
0
2
5
17,783
spotify/luigi
spotify_luigi/luigi/contrib/opener.py
luigi.contrib.opener.OpenerError
from luigi.target import FileSystemException class OpenerError(FileSystemException): """The base exception thrown by openers""" pass
class OpenerError(FileSystemException): '''The base exception thrown by openers''' pass
1
1
0
0
0
0
0
0.5
1
0
0
2
0
0
0
10
4
1
2
1
1
1
2
1
1
0
4
0
0
17,784
spotify/luigi
spotify_luigi/luigi/contrib/opener.py
luigi.contrib.opener.OpenerRegistry
from urllib.parse import urlsplit, parse_qs class OpenerRegistry: def __init__(self, openers=None): """An opener registry that stores a number of opener objects used to parse Target URIs :param openers: A list of objects inherited from the Opener class. :type openers: list ...
class OpenerRegistry: def __init__(self, openers=None): '''An opener registry that stores a number of opener objects used to parse Target URIs :param openers: A list of objects inherited from the Opener class. :type openers: list ''' pass def get_opener(self, ...
5
4
17
4
9
5
2
0.53
0
1
1
0
4
3
4
4
73
18
36
15
31
19
26
15
21
3
0
1
8
17,785
spotify/luigi
spotify_luigi/luigi/contrib/opener.py
luigi.contrib.opener.S3Opener
from luigi.contrib.s3 import S3Target class S3Opener(Opener): """Opens a target stored on Amazon S3 storage examples: * s3://bucket/foo/bar.txt * s3://bucket/foo/bar.txt?aws_access_key_id=xxx&aws_secret_access_key=yyy """ names = ['s3', 's3n'] allowed_kwargs = {'format': False, 'client': ...
class S3Opener(Opener): '''Opens a target stored on Amazon S3 storage examples: * s3://bucket/foo/bar.txt * s3://bucket/foo/bar.txt?aws_access_key_id=xxx&aws_secret_access_key=yyy ''' @classmethod def get_target(cls, scheme, path, fragment, username, password, hostname, port, query, **kwarg...
3
1
5
0
5
0
1
0.38
1
1
1
0
0
0
1
3
22
4
13
7
9
5
7
5
5
1
1
0
1
17,786
spotify/luigi
spotify_luigi/luigi/contrib/pai.py
luigi.contrib.pai.OpenPai
import luigi class OpenPai(luigi.Config): pai_url = luigi.Parameter(default='http://127.0.0.1:9186', description='rest server url, default is http://127.0.0.1:9186') username = luigi.Parameter(default='admin', description='your username') password = luigi.Parameter(default=None, description='your password'...
class OpenPai(luigi.Config): pass
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
78
13
0
13
5
12
0
5
5
4
0
6
0
0
17,787
spotify/luigi
spotify_luigi/luigi/contrib/pai.py
luigi.contrib.pai.PaiJob
class PaiJob: """ The Open PAI job definition. Refer to here https://github.com/Microsoft/pai/blob/master/docs/job_tutorial.md :: { "jobName": String, "image": String, "authFile": String, "dataDir": String, "outputDir": String, ...
class PaiJob: ''' The Open PAI job definition. Refer to here https://github.com/Microsoft/pai/blob/master/docs/job_tutorial.md :: { "jobName": String, "image": String, "authFile": String, "dataDir": String, "outputDir": String, ...
2
2
14
1
7
6
2
3.5
0
2
0
0
1
3
1
1
58
4
12
6
10
42
8
6
6
2
0
1
2
17,788
spotify/luigi
spotify_luigi/luigi/contrib/pai.py
luigi.contrib.pai.PaiTask
import luigi import time import abc from urllib.parse import urljoin import json class PaiTask(luigi.Task): __POLL_TIME = 5 @property @abc.abstractmethod def name(self): """Name for the job, need to be unique, required""" return 'SklearnExample' @property @abc.abstractmethod ...
class PaiTask(luigi.Task): @property @abc.abstractmethod def name(self): '''Name for the job, need to be unique, required''' pass @property @abc.abstractmethod def image(self): '''URL pointing to the Docker image for all tasks in the job, required''' pass @p...
30
11
7
0
6
1
2
0.14
1
6
2
1
16
2
16
94
136
17
104
40
74
15
83
30
66
5
5
2
25
17,789
spotify/luigi
spotify_luigi/luigi/contrib/pai.py
luigi.contrib.pai.Port
class Port: __slots__ = ('label', 'beginAt', 'portNumber') def __init__(self, label, begin_at=0, port_number=1): """ The Port definition for TaskRole :param label: Label name for the port type, required :param begin_at: The port to begin with in the port type, 0 for random sele...
class Port: def __init__(self, label, begin_at=0, port_number=1): ''' The Port definition for TaskRole :param label: Label name for the port type, required :param begin_at: The port to begin with in the port type, 0 for random selection, required :param port_number: Number o...
2
1
11
1
4
6
1
1
0
0
0
0
1
3
1
1
14
2
6
6
4
6
6
6
4
1
0
0
1
17,790
spotify/luigi
spotify_luigi/luigi/contrib/pai.py
luigi.contrib.pai.TaskRole
class TaskRole: __slots__ = ('name', 'taskNumber', 'cpuNumber', 'memoryMB', 'shmMB', 'gpuNumber', 'portList', 'command', 'minFailedTaskCount', 'minSucceededTaskCount') def __init__(self, name, command, taskNumber=1, cpuNumber=1, memoryMB=2048, shmMB=64, gpuNumber=0, portList=[]): """ The TaskRo...
class TaskRole: def __init__(self, name, command, taskNumber=1, cpuNumber=1, memoryMB=2048, shmMB=64, gpuNumber=0, portList=[]): ''' The TaskRole of PAI :param name: Name for the task role, need to be unique with other roles, required :param command: Executable command for tasks in ...
2
1
21
1
9
11
1
0.79
0
0
0
0
1
8
1
1
27
2
14
11
12
11
11
11
9
1
0
0
1
17,791
spotify/luigi
spotify_luigi/luigi/contrib/pig.py
luigi.contrib.pig.PigJobError
class PigJobError(RuntimeError): def __init__(self, message, out=None, err=None): super(PigJobError, self).__init__(message, out, err) self.message = message self.out = out self.err = err def __str__(self): info = self.message if self.out: info += '\...
class PigJobError(RuntimeError): def __init__(self, message, out=None, err=None): pass def __str__(self): pass
3
0
6
0
6
0
2
0
1
2
0
0
2
3
2
13
14
1
13
7
10
0
13
7
10
3
4
1
4
17,792
spotify/luigi
spotify_luigi/luigi/contrib/pig.py
luigi.contrib.pig.PigJobTask
import os from luigi import configuration import subprocess import luigi import tempfile import select from contextlib import contextmanager class PigJobTask(luigi.Task): def pig_home(self): return configuration.get_config().get('pig', 'home', '/usr/share/pig') def pig_command_path(self): ret...
class PigJobTask(luigi.Task): def pig_home(self): pass def pig_command_path(self): pass def pig_env_vars(self): ''' Dictionary of environment variables that should be set when running Pig. Ex:: return { 'PIG_CLASSPATH': '/your/path' } ''' ...
14
5
10
1
6
2
2
0.33
1
4
2
2
11
0
11
89
126
26
75
32
61
25
73
29
60
10
5
4
23
17,793
spotify/luigi
spotify_luigi/luigi/contrib/pig.py
luigi.contrib.pig.PigRunContext
import signal import sys import subprocess class PigRunContext: def __init__(self): self.job_id = None def __enter__(self): self.__old_signal = signal.getsignal(signal.SIGTERM) signal.signal(signal.SIGTERM, self.kill_job) return self def kill_job(self, captured_signal=Non...
class PigRunContext: def __init__(self): pass def __enter__(self): pass def kill_job(self, captured_signal=None, stack_frame=None): pass def __exit__(self, exc_type, exc_val, exc_tb): pass
5
0
4
0
4
0
2
0.06
0
1
0
0
4
2
4
4
21
3
17
7
12
1
17
7
12
3
0
1
7
17,794
spotify/luigi
spotify_luigi/luigi/contrib/postgres.py
luigi.contrib.postgres.CopyToTable
import tempfile from luigi.contrib import rdbms import luigi import datetime class CopyToTable(rdbms.CopyToTable): """ Template task for inserting a data set into Postgres Usage: Subclass and override the required `host`, `database`, `user`, `password`, `table` and `columns` attributes. To cu...
class CopyToTable(rdbms.CopyToTable): ''' Template task for inserting a data set into Postgres Usage: Subclass and override the required `host`, `database`, `user`, `password`, `table` and `columns` attributes. To customize how to access data from an input task, override the `rows` method w...
6
5
22
2
15
5
4
0.46
1
5
1
3
5
7
5
103
129
18
76
26
70
35
58
17
52
9
6
4
18
17,795
spotify/luigi
spotify_luigi/luigi/contrib/postgres.py
luigi.contrib.postgres.MultiReplacer
import re class MultiReplacer: """ Object for one-pass replace of multiple words Substituted parts will not be matched against other replace patterns, as opposed to when using multipass replace. The order of the items in the replace_pairs input will dictate replacement precedence. Constructor arg...
class MultiReplacer: ''' Object for one-pass replace of multiple words Substituted parts will not be matched against other replace patterns, as opposed to when using multipass replace. The order of the items in the replace_pairs input will dictate replacement precedence. Constructor arguments: ...
4
2
6
0
3
3
1
2.7
0
2
0
0
3
2
3
3
45
9
10
8
6
27
10
8
6
1
0
0
3
17,796
spotify/luigi
spotify_luigi/luigi/contrib/postgres.py
luigi.contrib.postgres.PostgresQuery
from luigi.contrib import rdbms class PostgresQuery(rdbms.Query): """ Template task for querying a Postgres compatible database Usage: Subclass and override the required `host`, `database`, `user`, `password`, `table`, and `query` attributes. Optionally one can override the `autocommit` attribute ...
class PostgresQuery(rdbms.Query): ''' Template task for querying a Postgres compatible database Usage: Subclass and override the required `host`, `database`, `user`, `password`, `table`, and `query` attributes. Optionally one can override the `autocommit` attribute to put the connection for the que...
3
2
15
2
10
3
1
0.71
1
1
1
3
2
6
2
92
45
9
21
12
18
15
13
6
10
1
6
0
2
17,797
spotify/luigi
spotify_luigi/luigi/contrib/postgres.py
luigi.contrib.postgres.PostgresTarget
import luigi import datetime class PostgresTarget(luigi.Target): """ Target for a resource in Postgres. This will rarely have to be directly instantiated by the user. """ marker_table = luigi.configuration.get_config().get('postgres', 'marker-table', 'table_updates') DEFAULT_DB_PORT = 5432 ...
class PostgresTarget(luigi.Target): ''' Target for a resource in Postgres. This will rarely have to be directly instantiated by the user. ''' def __init__(self, host, database, user, password, table, update_id, port=None): ''' Args: host (str): Postgres server address. ...
8
5
16
1
12
3
2
0.33
1
2
0
1
7
7
7
28
135
16
90
27
80
30
57
23
49
4
4
2
16
17,798
spotify/luigi
spotify_luigi/luigi/contrib/presto.py
luigi.contrib.presto.PrestoClient
from enum import Enum from contextlib import closing from time import sleep class PrestoClient: """ Helper class wrapping `pyhive.presto.Connection` for executing presto queries and tracking progress """ def __init__(self, connection, sleep_time=1): self.sleep_time = sleep_time sel...
class PrestoClient: ''' Helper class wrapping `pyhive.presto.Connection` for executing presto queries and tracking progress ''' def __init__(self, connection, sleep_time=1): pass @property def percentage_progress(self): ''' :return: percentage of query overall progr...
8
4
11
1
7
3
3
0.55
0
2
1
0
4
3
4
4
53
8
29
17
21
16
27
14
21
7
0
4
10
17,799
spotify/luigi
spotify_luigi/luigi/contrib/presto.py
luigi.contrib.presto.PrestoTarget
from collections import OrderedDict import re import luigi class PrestoTarget(luigi.Target): """ Target for presto-accessible tables """ def __init__(self, client, catalog, database, table, partition=None): self.catalog = catalog self.database = database self.table = table ...
class PrestoTarget(luigi.Target): ''' Target for presto-accessible tables ''' def __init__(self, client, catalog, database, table, partition=None): pass def __str__(self): pass @property def _count_query(self): pass def _clauses(): pass ...
9
2
9
1
7
1
2
0.24
1
3
0
0
6
6
6
27
72
9
51
23
42
12
38
21
30
4
4
2
13