repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
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
train
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
train
spotify/luigi
luigi/contrib/mssqldb.py
MSSqlTarget.touch
def touch(self, connection=None): """ Mark this update as complete. IMPORTANT, If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created. """ self.create_marker_table() i...
python
def touch(self, connection=None): """ Mark this update as complete. IMPORTANT, If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created. """ self.create_marker_table() i...
[ "def", "touch", "(", "self", ",", "connection", "=", "None", ")", ":", "self", ".", "create_marker_table", "(", ")", "if", "connection", "is", "None", ":", "connection", "=", "self", ".", "connect", "(", ")", "connection", ".", "execute_non_query", "(", ...
Mark this update as complete. IMPORTANT, If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created.
[ "Mark", "this", "update", "as", "complete", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mssqldb.py#L71-L100
train
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
train
spotify/luigi
luigi/contrib/mssqldb.py
MSSqlTarget.create_marker_table
def create_marker_table(self): """ Create marker table if it doesn't exist. Use a separate connection since the transaction might have to be reset. """ connection = self.connect() try: connection.execute_non_query( """ CREATE TABLE {marker_tabl...
python
def create_marker_table(self): """ Create marker table if it doesn't exist. Use a separate connection since the transaction might have to be reset. """ connection = self.connect() try: connection.execute_non_query( """ CREATE TABLE {marker_tabl...
[ "def", "create_marker_table", "(", "self", ")", ":", "connection", "=", "self", ".", "connect", "(", ")", "try", ":", "connection", ".", "execute_non_query", "(", "\"\"\" CREATE TABLE {marker_table} (\n id BIGINT NOT NULL IDENTITY(1,1),\n ...
Create marker table if it doesn't exist. Use a separate connection since the transaction might have to be reset.
[ "Create", "marker", "table", "if", "it", "doesn", "t", "exist", ".", "Use", "a", "separate", "connection", "since", "the", "transaction", "might", "have", "to", "be", "reset", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mssqldb.py#L130-L154
train
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
train
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
train
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
train
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
train
spotify/luigi
luigi/contrib/opener.py
Opener.get_target
def get_target(cls, scheme, path, fragment, username, password, hostname, port, query, **kwargs): """Override this method to use values from the parsed uri to initialize the expected target. """ raise NotImplementedError("get_target must be overridden")
python
def get_target(cls, scheme, path, fragment, username, password, hostname, port, query, **kwargs): """Override this method to use values from the parsed uri to initialize the expected target. """ raise NotImplementedError("get_target must be overridden")
[ "def", "get_target", "(", "cls", ",", "scheme", ",", "path", ",", "fragment", ",", "username", ",", "password", ",", "hostname", ",", "port", ",", "query", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"get_target must be overridd...
Override this method to use values from the parsed uri to initialize the expected target.
[ "Override", "this", "method", "to", "use", "values", "from", "the", "parsed", "uri", "to", "initialize", "the", "expected", "target", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/opener.py#L186-L192
train
spotify/luigi
luigi/interface.py
_schedule_and_run
def _schedule_and_run(tasks, worker_scheduler_factory=None, override_defaults=None): """ :param tasks: :param worker_scheduler_factory: :param override_defaults: :return: True if all tasks and their dependencies were successfully run (or already completed); False if any error occurred. ...
python
def _schedule_and_run(tasks, worker_scheduler_factory=None, override_defaults=None): """ :param tasks: :param worker_scheduler_factory: :param override_defaults: :return: True if all tasks and their dependencies were successfully run (or already completed); False if any error occurred. ...
[ "def", "_schedule_and_run", "(", "tasks", ",", "worker_scheduler_factory", "=", "None", ",", "override_defaults", "=", "None", ")", ":", "if", "worker_scheduler_factory", "is", "None", ":", "worker_scheduler_factory", "=", "_WorkerSchedulerFactory", "(", ")", "if", ...
:param tasks: :param worker_scheduler_factory: :param override_defaults: :return: True if all tasks and their dependencies were successfully run (or already completed); False if any error occurred. It will return a detailed response of type LuigiRunResult instead of a boolean if de...
[ ":", "param", "tasks", ":", ":", "param", "worker_scheduler_factory", ":", ":", "param", "override_defaults", ":", ":", "return", ":", "True", "if", "all", "tasks", "and", "their", "dependencies", "were", "successfully", "run", "(", "or", "already", "completed...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/interface.py#L129-L176
train
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
train
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
train
spotify/luigi
luigi/contrib/mysqldb.py
MySqlTarget.touch
def touch(self, connection=None): """ Mark this update as complete. IMPORTANT, If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created. """ self.create_marker_table() i...
python
def touch(self, connection=None): """ Mark this update as complete. IMPORTANT, If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created. """ self.create_marker_table() i...
[ "def", "touch", "(", "self", ",", "connection", "=", "None", ")", ":", "self", ".", "create_marker_table", "(", ")", "if", "connection", "is", "None", ":", "connection", "=", "self", ".", "connect", "(", ")", "connection", ".", "autocommit", "=", "True",...
Mark this update as complete. IMPORTANT, If the marker table doesn't exist, the connection transaction will be aborted and the connection reset. Then the marker table will be created.
[ "Mark", "this", "update", "as", "complete", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mysqldb.py#L71-L94
train
spotify/luigi
luigi/contrib/mysqldb.py
MySqlTarget.create_marker_table
def create_marker_table(self): """ Create marker table if it doesn't exist. Using a separate connection since the transaction might have to be reset. """ connection = self.connect(autocommit=True) cursor = connection.cursor() try: cursor.execute( ...
python
def create_marker_table(self): """ Create marker table if it doesn't exist. Using a separate connection since the transaction might have to be reset. """ connection = self.connect(autocommit=True) cursor = connection.cursor() try: cursor.execute( ...
[ "def", "create_marker_table", "(", "self", ")", ":", "connection", "=", "self", ".", "connect", "(", "autocommit", "=", "True", ")", "cursor", "=", "connection", ".", "cursor", "(", ")", "try", ":", "cursor", ".", "execute", "(", "\"\"\" CREATE TABLE {marker...
Create marker table if it doesn't exist. Using a separate connection since the transaction might have to be reset.
[ "Create", "marker", "table", "if", "it", "doesn", "t", "exist", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mysqldb.py#L125-L151
train
spotify/luigi
luigi/contrib/mysqldb.py
CopyToTable.run
def run(self): """ Inserts data generated by rows() into target table. If the target table doesn't exist, self.create_table will be called to attempt to create the table. Normally you don't want to override this. """ if not (self.table and self.columns): rai...
python
def run(self): """ Inserts data generated by rows() into target table. If the target table doesn't exist, self.create_table will be called to attempt to create the table. Normally you don't want to override this. """ if not (self.table and self.columns): rai...
[ "def", "run", "(", "self", ")", ":", "if", "not", "(", "self", ".", "table", "and", "self", ".", "columns", ")", ":", "raise", "Exception", "(", "\"table and columns need to be specified\"", ")", "connection", "=", "self", ".", "output", "(", ")", ".", "...
Inserts data generated by rows() into target table. If the target table doesn't exist, self.create_table will be called to attempt to create the table. Normally you don't want to override this.
[ "Inserts", "data", "generated", "by", "rows", "()", "into", "target", "table", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mysqldb.py#L207-L246
train
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
train
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
train
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
train
spotify/luigi
luigi/contrib/batch.py
BatchClient.get_job_status
def get_job_status(self, job_id): """Retrieve task statuses from ECS API :param job_id (str): AWS Batch job uuid Returns one of {SUBMITTED|PENDING|RUNNABLE|STARTING|RUNNING|SUCCEEDED|FAILED} """ response = self._client.describe_jobs(jobs=[job_id]) # Error checking ...
python
def get_job_status(self, job_id): """Retrieve task statuses from ECS API :param job_id (str): AWS Batch job uuid Returns one of {SUBMITTED|PENDING|RUNNABLE|STARTING|RUNNING|SUCCEEDED|FAILED} """ response = self._client.describe_jobs(jobs=[job_id]) # Error checking ...
[ "def", "get_job_status", "(", "self", ",", "job_id", ")", ":", "response", "=", "self", ".", "_client", ".", "describe_jobs", "(", "jobs", "=", "[", "job_id", "]", ")", "# Error checking", "status_code", "=", "response", "[", "'ResponseMetadata'", "]", "[", ...
Retrieve task statuses from ECS API :param job_id (str): AWS Batch job uuid Returns one of {SUBMITTED|PENDING|RUNNABLE|STARTING|RUNNING|SUCCEEDED|FAILED}
[ "Retrieve", "task", "statuses", "from", "ECS", "API" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L115-L130
train
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
train
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
train
spotify/luigi
luigi/contrib/batch.py
BatchClient.wait_on_job
def wait_on_job(self, job_id): """Poll task status until STOPPED""" while True: status = self.get_job_status(job_id) if status == 'SUCCEEDED': logger.info('Batch job {} SUCCEEDED'.format(job_id)) return True elif status == 'FAILED': ...
python
def wait_on_job(self, job_id): """Poll task status until STOPPED""" while True: status = self.get_job_status(job_id) if status == 'SUCCEEDED': logger.info('Batch job {} SUCCEEDED'.format(job_id)) return True elif status == 'FAILED': ...
[ "def", "wait_on_job", "(", "self", ",", "job_id", ")", ":", "while", "True", ":", "status", "=", "self", ".", "get_job_status", "(", "job_id", ")", "if", "status", "==", "'SUCCEEDED'", ":", "logger", ".", "info", "(", "'Batch job {} SUCCEEDED'", ".", "form...
Poll task status until STOPPED
[ "Poll", "task", "status", "until", "STOPPED" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/batch.py#L153-L174
train
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
train
spotify/luigi
luigi/contrib/sge_runner.py
main
def main(args=sys.argv): """Run the work() method from the class instance in the file "job-instance.pickle". """ try: tarball = "--no-tarball" not in args # Set up logging. logging.basicConfig(level=logging.WARN) work_dir = args[1] assert os.path.exists(work_dir), "Fi...
python
def main(args=sys.argv): """Run the work() method from the class instance in the file "job-instance.pickle". """ try: tarball = "--no-tarball" not in args # Set up logging. logging.basicConfig(level=logging.WARN) work_dir = args[1] assert os.path.exists(work_dir), "Fi...
[ "def", "main", "(", "args", "=", "sys", ".", "argv", ")", ":", "try", ":", "tarball", "=", "\"--no-tarball\"", "not", "in", "args", "# Set up logging.", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "WARN", ")", "work_dir", "=", "args...
Run the work() method from the class instance in the file "job-instance.pickle".
[ "Run", "the", "work", "()", "method", "from", "the", "class", "instance", "in", "the", "file", "job", "-", "instance", ".", "pickle", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/sge_runner.py#L80-L95
train
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
train
spotify/luigi
luigi/tools/deps_tree.py
print_tree
def print_tree(task, indent='', last=True): ''' Return a string representation of the tasks, their statuses/parameters in a dependency tree format ''' # dont bother printing out warnings about tasks with no output with warnings.catch_warnings(): warnings.filterwarnings(action='ignore', messa...
python
def print_tree(task, indent='', last=True): ''' Return a string representation of the tasks, their statuses/parameters in a dependency tree format ''' # dont bother printing out warnings about tasks with no output with warnings.catch_warnings(): warnings.filterwarnings(action='ignore', messa...
[ "def", "print_tree", "(", "task", ",", "indent", "=", "''", ",", "last", "=", "True", ")", ":", "# dont bother printing out warnings about tasks with no output", "with", "warnings", ".", "catch_warnings", "(", ")", ":", "warnings", ".", "filterwarnings", "(", "act...
Return a string representation of the tasks, their statuses/parameters in a dependency tree format
[ "Return", "a", "string", "representation", "of", "the", "tasks", "their", "statuses", "/", "parameters", "in", "a", "dependency", "tree", "format" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/deps_tree.py#L41-L63
train
spotify/luigi
luigi/rpc.py
_urljoin
def _urljoin(base, url): """ Join relative URLs to base URLs like urllib.parse.urljoin but support arbitrary URIs (esp. 'http+unix://'). """ parsed = urlparse(base) scheme = parsed.scheme return urlparse( urljoin(parsed._replace(scheme='http').geturl(), url) )._replace(scheme=sch...
python
def _urljoin(base, url): """ Join relative URLs to base URLs like urllib.parse.urljoin but support arbitrary URIs (esp. 'http+unix://'). """ parsed = urlparse(base) scheme = parsed.scheme return urlparse( urljoin(parsed._replace(scheme='http').geturl(), url) )._replace(scheme=sch...
[ "def", "_urljoin", "(", "base", ",", "url", ")", ":", "parsed", "=", "urlparse", "(", "base", ")", "scheme", "=", "parsed", ".", "scheme", "return", "urlparse", "(", "urljoin", "(", "parsed", ".", "_replace", "(", "scheme", "=", "'http'", ")", ".", "...
Join relative URLs to base URLs like urllib.parse.urljoin but support arbitrary URIs (esp. 'http+unix://').
[ "Join", "relative", "URLs", "to", "base", "URLs", "like", "urllib", ".", "parse", ".", "urljoin", "but", "support", "arbitrary", "URIs", "(", "esp", ".", "http", "+", "unix", ":", "//", ")", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/rpc.py#L52-L61
train
spotify/luigi
luigi/contrib/bigquery.py
BigQueryClient.dataset_exists
def dataset_exists(self, dataset): """Returns whether the given dataset exists. If regional location is specified for the dataset, that is also checked to be compatible with the remote dataset, otherwise an exception is thrown. :param dataset: :type dataset: BQDataset ...
python
def dataset_exists(self, dataset): """Returns whether the given dataset exists. If regional location is specified for the dataset, that is also checked to be compatible with the remote dataset, otherwise an exception is thrown. :param dataset: :type dataset: BQDataset ...
[ "def", "dataset_exists", "(", "self", ",", "dataset", ")", ":", "try", ":", "response", "=", "self", ".", "client", ".", "datasets", "(", ")", ".", "get", "(", "projectId", "=", "dataset", ".", "project_id", ",", "datasetId", "=", "dataset", ".", "data...
Returns whether the given dataset exists. If regional location is specified for the dataset, that is also checked to be compatible with the remote dataset, otherwise an exception is thrown. :param dataset: :type dataset: BQDataset
[ "Returns", "whether", "the", "given", "dataset", "exists", ".", "If", "regional", "location", "is", "specified", "for", "the", "dataset", "that", "is", "also", "checked", "to", "be", "compatible", "with", "the", "remote", "dataset", "otherwise", "an", "excepti...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L131-L155
train
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
train
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
train
spotify/luigi
luigi/contrib/bigquery.py
BigQueryClient.delete_dataset
def delete_dataset(self, dataset, delete_nonempty=True): """Deletes a dataset (and optionally any tables in it), if it exists. :param dataset: :type dataset: BQDataset :param delete_nonempty: if true, will delete any tables before deleting the dataset """ if no...
python
def delete_dataset(self, dataset, delete_nonempty=True): """Deletes a dataset (and optionally any tables in it), if it exists. :param dataset: :type dataset: BQDataset :param delete_nonempty: if true, will delete any tables before deleting the dataset """ if no...
[ "def", "delete_dataset", "(", "self", ",", "dataset", ",", "delete_nonempty", "=", "True", ")", ":", "if", "not", "self", ".", "dataset_exists", "(", "dataset", ")", ":", "return", "self", ".", "client", ".", "datasets", "(", ")", ".", "delete", "(", "...
Deletes a dataset (and optionally any tables in it), if it exists. :param dataset: :type dataset: BQDataset :param delete_nonempty: if true, will delete any tables before deleting the dataset
[ "Deletes", "a", "dataset", "(", "and", "optionally", "any", "tables", "in", "it", ")", "if", "it", "exists", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L206-L219
train
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
train
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
train
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
train
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
train
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
train
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
train
spotify/luigi
luigi/contrib/bigquery.py
BigQueryClient.copy
def copy(self, source_table, dest_table, create_disposition=CreateDisposition.CREATE_IF_NEEDED, write_disposition=WriteDisposition.WRITE_TRUNCATE): """Copies (or appends) a table to another table. :param source_table: :type source_tabl...
python
def copy(self, source_table, dest_table, create_disposition=CreateDisposition.CREATE_IF_NEEDED, write_disposition=WriteDisposition.WRITE_TRUNCATE): """Copies (or appends) a table to another table. :param source_table: :type source_tabl...
[ "def", "copy", "(", "self", ",", "source_table", ",", "dest_table", ",", "create_disposition", "=", "CreateDisposition", ".", "CREATE_IF_NEEDED", ",", "write_disposition", "=", "WriteDisposition", ".", "WRITE_TRUNCATE", ")", ":", "job", "=", "{", "\"configuration\""...
Copies (or appends) a table to another table. :param source_table: :type source_table: BQTable :param dest_table: :type dest_table: BQTable :param create_disposition: whether to create the table if needed :type create_disposition: CreateDispositio...
[ "Copies", "(", "or", "appends", ")", "a", "table", "to", "another", "table", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L357-L393
train
spotify/luigi
luigi/contrib/bigquery.py
BigQueryTarget.from_bqtable
def from_bqtable(cls, table, client=None): """A constructor that takes a :py:class:`BQTable`. :param table: :type table: BQTable """ return cls(table.project_id, table.dataset_id, table.table_id, client=client)
python
def from_bqtable(cls, table, client=None): """A constructor that takes a :py:class:`BQTable`. :param table: :type table: BQTable """ return cls(table.project_id, table.dataset_id, table.table_id, client=client)
[ "def", "from_bqtable", "(", "cls", ",", "table", ",", "client", "=", "None", ")", ":", "return", "cls", "(", "table", ".", "project_id", ",", "table", ".", "dataset_id", ",", "table", ".", "table_id", ",", "client", "=", "client", ")" ]
A constructor that takes a :py:class:`BQTable`. :param table: :type table: BQTable
[ "A", "constructor", "that", "takes", "a", ":", "py", ":", "class", ":", "BQTable", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L402-L408
train
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
train
spotify/luigi
luigi/contrib/bigquery.py
BigQueryExtractTask.destination_uris
def destination_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. Wildcarded destinationUris in GCSQueryTarget might not be resolved correctl...
python
def destination_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. Wildcarded destinationUris in GCSQueryTarget might not be resolved correctl...
[ "def", "destination_uris", "(", "self", ")", ":", "return", "[", "x", ".", "path", "for", "x", "in", "luigi", ".", "task", ".", "flatten", "(", "self", ".", "output", "(", ")", ")", "]" ]
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. Wildcarded destinationUris in GCSQueryTarget might not be resolved correctly and result in incomplete data. If a GCSQueryTa...
[ "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", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/bigquery.py#L701-L712
train
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
train
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
train
spotify/luigi
luigi/contrib/ssh.py
RemoteContext.tunnel
def tunnel(self, local_port, remote_port=None, remote_host="localhost"): """ Open a tunnel between localhost:local_port and remote_host:remote_port via the host specified by this context. Remember to close() the returned "tunnel" object in order to clean up after yourself when you are d...
python
def tunnel(self, local_port, remote_port=None, remote_host="localhost"): """ Open a tunnel between localhost:local_port and remote_host:remote_port via the host specified by this context. Remember to close() the returned "tunnel" object in order to clean up after yourself when you are d...
[ "def", "tunnel", "(", "self", ",", "local_port", ",", "remote_port", "=", "None", ",", "remote_host", "=", "\"localhost\"", ")", ":", "tunnel_host", "=", "\"{0}:{1}:{2}\"", ".", "format", "(", "local_port", ",", "remote_host", ",", "remote_port", ")", "proc", ...
Open a tunnel between localhost:local_port and remote_host:remote_port via the host specified by this context. Remember to close() the returned "tunnel" object in order to clean up after yourself when you are done with the tunnel.
[ "Open", "a", "tunnel", "between", "localhost", ":", "local_port", "and", "remote_host", ":", "remote_port", "via", "the", "host", "specified", "by", "this", "context", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/ssh.py#L136-L155
train
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
train
spotify/luigi
luigi/contrib/ssh.py
RemoteFileSystem.remove
def remove(self, path, recursive=True): """ Remove file or directory at location `path`. """ if recursive: cmd = ["rm", "-r", path] else: cmd = ["rm", path] self.remote_context.check_output(cmd)
python
def remove(self, path, recursive=True): """ Remove file or directory at location `path`. """ if recursive: cmd = ["rm", "-r", path] else: cmd = ["rm", path] self.remote_context.check_output(cmd)
[ "def", "remove", "(", "self", ",", "path", ",", "recursive", "=", "True", ")", ":", "if", "recursive", ":", "cmd", "=", "[", "\"rm\"", ",", "\"-r\"", ",", "path", "]", "else", ":", "cmd", "=", "[", "\"rm\"", ",", "path", "]", "self", ".", "remote...
Remove file or directory at location `path`.
[ "Remove", "file", "or", "directory", "at", "location", "path", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/ssh.py#L197-L206
train
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
train
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
train
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
train
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
train
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
train
spotify/luigi
luigi/scheduler.py
SimpleTaskState.num_pending_tasks
def num_pending_tasks(self): """ Return how many tasks are PENDING + RUNNING. O(1). """ return len(self._status_tasks[PENDING]) + len(self._status_tasks[RUNNING])
python
def num_pending_tasks(self): """ Return how many tasks are PENDING + RUNNING. O(1). """ return len(self._status_tasks[PENDING]) + len(self._status_tasks[RUNNING])
[ "def", "num_pending_tasks", "(", "self", ")", ":", "return", "len", "(", "self", ".", "_status_tasks", "[", "PENDING", "]", ")", "+", "len", "(", "self", ".", "_status_tasks", "[", "RUNNING", "]", ")" ]
Return how many tasks are PENDING + RUNNING. O(1).
[ "Return", "how", "many", "tasks", "are", "PENDING", "+", "RUNNING", ".", "O", "(", "1", ")", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/scheduler.py#L518-L522
train
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
train
spotify/luigi
luigi/scheduler.py
Scheduler.add_task
def add_task(self, task_id=None, status=PENDING, runnable=True, deps=None, new_deps=None, expl=None, resources=None, priority=0, family='', module=None, params=None, param_visibilities=None, accepts_messages=False, assistant=False, tracking_url=None, worker=None, batch...
python
def add_task(self, task_id=None, status=PENDING, runnable=True, deps=None, new_deps=None, expl=None, resources=None, priority=0, family='', module=None, params=None, param_visibilities=None, accepts_messages=False, assistant=False, tracking_url=None, worker=None, batch...
[ "def", "add_task", "(", "self", ",", "task_id", "=", "None", ",", "status", "=", "PENDING", ",", "runnable", "=", "True", ",", "deps", "=", "None", ",", "new_deps", "=", "None", ",", "expl", "=", "None", ",", "resources", "=", "None", ",", "priority"...
* add task identified by task_id if it doesn't exist * if deps is not None, update dependency list * update status of task * add additional workers/stakeholders * update priority when needed
[ "*", "add", "task", "identified", "by", "task_id", "if", "it", "doesn", "t", "exist", "*", "if", "deps", "is", "not", "None", "update", "dependency", "list", "*", "update", "status", "of", "task", "*", "add", "additional", "workers", "/", "stakeholders", ...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/scheduler.py#L803-L940
train
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
train
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
train
spotify/luigi
luigi/scheduler.py
Scheduler.resource_list
def resource_list(self): """ Resources usage info and their consumers (tasks). """ self.prune() resources = [ dict( name=resource, num_total=r_dict['total'], num_used=r_dict['used'] ) for resource, r_dict in ...
python
def resource_list(self): """ Resources usage info and their consumers (tasks). """ self.prune() resources = [ dict( name=resource, num_total=r_dict['total'], num_used=r_dict['used'] ) for resource, r_dict in ...
[ "def", "resource_list", "(", "self", ")", ":", "self", ".", "prune", "(", ")", "resources", "=", "[", "dict", "(", "name", "=", "resource", ",", "num_total", "=", "r_dict", "[", "'total'", "]", ",", "num_used", "=", "r_dict", "[", "'used'", "]", ")",...
Resources usage info and their consumers (tasks).
[ "Resources", "usage", "info", "and", "their", "consumers", "(", "tasks", ")", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/scheduler.py#L1500-L1521
train
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
train
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
train
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
train
spotify/luigi
luigi/target.py
FileSystemTarget.temporary_path
def temporary_path(self): """ A context manager that enables a reasonably short, general and magic-less way to solve the :ref:`AtomicWrites`. * On *entering*, it will create the parent directories so the temporary_path is writeable right away. This step uses :py:m...
python
def temporary_path(self): """ A context manager that enables a reasonably short, general and magic-less way to solve the :ref:`AtomicWrites`. * On *entering*, it will create the parent directories so the temporary_path is writeable right away. This step uses :py:m...
[ "def", "temporary_path", "(", "self", ")", ":", "num", "=", "random", ".", "randrange", "(", "0", ",", "1e10", ")", "slashless_path", "=", "self", ".", "path", ".", "rstrip", "(", "'/'", ")", ".", "rstrip", "(", "\"\\\\\"", ")", "_temp_path", "=", "'...
A context manager that enables a reasonably short, general and magic-less way to solve the :ref:`AtomicWrites`. * On *entering*, it will create the parent directories so the temporary_path is writeable right away. This step uses :py:meth:`FileSystem.mkdir`. * On *exiting...
[ "A", "context", "manager", "that", "enables", "a", "reasonably", "short", "general", "and", "magic", "-", "less", "way", "to", "solve", "the", ":", "ref", ":", "AtomicWrites", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/target.py#L263-L301
train
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
train
spotify/luigi
luigi/contrib/esindex.py
ElasticsearchTarget.touch
def touch(self): """ Mark this update as complete. The document id would be sufficent but, for documentation, we index the parameters `update_id`, `target_index`, `target_doc_type` and `date` as well. """ self.create_marker_index() self.es.index(index=sel...
python
def touch(self): """ Mark this update as complete. The document id would be sufficent but, for documentation, we index the parameters `update_id`, `target_index`, `target_doc_type` and `date` as well. """ self.create_marker_index() self.es.index(index=sel...
[ "def", "touch", "(", "self", ")", ":", "self", ".", "create_marker_index", "(", ")", "self", ".", "es", ".", "index", "(", "index", "=", "self", ".", "marker_index", ",", "doc_type", "=", "self", ".", "marker_doc_type", ",", "id", "=", "self", ".", "...
Mark this update as complete. The document id would be sufficent but, for documentation, we index the parameters `update_id`, `target_index`, `target_doc_type` and `date` as well.
[ "Mark", "this", "update", "as", "complete", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/esindex.py#L168-L184
train
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
train
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
train
spotify/luigi
luigi/contrib/esindex.py
ElasticsearchTarget.ensure_hist_size
def ensure_hist_size(self): """ Shrink the history of updates for a `index/doc_type` combination down to `self.marker_index_hist_size`. """ if self.marker_index_hist_size == 0: return result = self.es.search(index=self.marker_index, ...
python
def ensure_hist_size(self): """ Shrink the history of updates for a `index/doc_type` combination down to `self.marker_index_hist_size`. """ if self.marker_index_hist_size == 0: return result = self.es.search(index=self.marker_index, ...
[ "def", "ensure_hist_size", "(", "self", ")", ":", "if", "self", ".", "marker_index_hist_size", "==", "0", ":", "return", "result", "=", "self", ".", "es", ".", "search", "(", "index", "=", "self", ".", "marker_index", ",", "doc_type", "=", "self", ".", ...
Shrink the history of updates for a `index/doc_type` combination down to `self.marker_index_hist_size`.
[ "Shrink", "the", "history", "of", "updates", "for", "a", "index", "/", "doc_type", "combination", "down", "to", "self", ".", "marker_index_hist_size", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/esindex.py#L206-L224
train
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
train
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
train
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
train
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
train
spotify/luigi
luigi/contrib/esindex.py
CopyToIndex.run
def run(self): """ Run task, namely: * purge existing index, if requested (`purge_existing_index`), * create the index, if missing, * apply mappings, if given, * set refresh interval to -1 (disable) for performance reasons, * bulk index in batches of size `chunk_...
python
def run(self): """ Run task, namely: * purge existing index, if requested (`purge_existing_index`), * create the index, if missing, * apply mappings, if given, * set refresh interval to -1 (disable) for performance reasons, * bulk index in batches of size `chunk_...
[ "def", "run", "(", "self", ")", ":", "if", "self", ".", "purge_existing_index", ":", "self", ".", "delete_index", "(", ")", "self", ".", "create_index", "(", ")", "es", "=", "self", ".", "_init_connection", "(", ")", "if", "self", ".", "mapping", ":", ...
Run task, namely: * purge existing index, if requested (`purge_existing_index`), * create the index, if missing, * apply mappings, if given, * set refresh interval to -1 (disable) for performance reasons, * bulk index in batches of size `chunk_size` (2000), * set refresh...
[ "Run", "task", "namely", ":" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/esindex.py#L436-L465
train
spotify/luigi
luigi/configuration/cfg_parser.py
LuigiConfigParser._get_with_default
def _get_with_default(self, method, section, option, default, expected_type=None, **kwargs): """ Gets the value of the section/option using method. Returns default if value is not found. Raises an exception if the default value is not None and doesn't match the expected_type. "...
python
def _get_with_default(self, method, section, option, default, expected_type=None, **kwargs): """ Gets the value of the section/option using method. Returns default if value is not found. Raises an exception if the default value is not None and doesn't match the expected_type. "...
[ "def", "_get_with_default", "(", "self", ",", "method", ",", "section", ",", "option", ",", "default", ",", "expected_type", "=", "None", ",", "*", "*", "kwargs", ")", ":", "try", ":", "try", ":", "# Underscore-style is the recommended configuration style", "opt...
Gets the value of the section/option using method. Returns default if value is not found. Raises an exception if the default value is not None and doesn't match the expected_type.
[ "Gets", "the", "value", "of", "the", "section", "/", "option", "using", "method", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/configuration/cfg_parser.py#L156-L183
train
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
train
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
train
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
train
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
train
spotify/luigi
luigi/contrib/sqla.py
SQLAlchemyTarget.touch
def touch(self): """ Mark this update as complete. """ if self.marker_table_bound is None: self.create_marker_table() table = self.marker_table_bound id_exists = self.exists() with self.engine.begin() as conn: if not id_exists: ...
python
def touch(self): """ Mark this update as complete. """ if self.marker_table_bound is None: self.create_marker_table() table = self.marker_table_bound id_exists = self.exists() with self.engine.begin() as conn: if not id_exists: ...
[ "def", "touch", "(", "self", ")", ":", "if", "self", ".", "marker_table_bound", "is", "None", ":", "self", ".", "create_marker_table", "(", ")", "table", "=", "self", ".", "marker_table_bound", "id_exists", "=", "self", ".", "exists", "(", ")", "with", "...
Mark this update as complete.
[ "Mark", "this", "update", "as", "complete", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/sqla.py#L212-L231
train
spotify/luigi
luigi/contrib/sqla.py
SQLAlchemyTarget.create_marker_table
def create_marker_table(self): """ Create marker table if it doesn't exist. Using a separate connection since the transaction might have to be reset. """ if self.marker_table is None: self.marker_table = luigi.configuration.get_config().get('sqlalchemy', 'marker-tabl...
python
def create_marker_table(self): """ Create marker table if it doesn't exist. Using a separate connection since the transaction might have to be reset. """ if self.marker_table is None: self.marker_table = luigi.configuration.get_config().get('sqlalchemy', 'marker-tabl...
[ "def", "create_marker_table", "(", "self", ")", ":", "if", "self", ".", "marker_table", "is", "None", ":", "self", ".", "marker_table", "=", "luigi", ".", "configuration", ".", "get_config", "(", ")", ".", "get", "(", "'sqlalchemy'", ",", "'marker-table'", ...
Create marker table if it doesn't exist. Using a separate connection since the transaction might have to be reset.
[ "Create", "marker", "table", "if", "it", "doesn", "t", "exist", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/sqla.py#L244-L266
train
spotify/luigi
luigi/contrib/sqla.py
CopyToTable.create_table
def create_table(self, engine): """ Override to provide code for creating the target table. By default it will be created using types specified in columns. If the table exists, then it binds to the existing table. If overridden, use the provided connection object for setting up...
python
def create_table(self, engine): """ Override to provide code for creating the target table. By default it will be created using types specified in columns. If the table exists, then it binds to the existing table. If overridden, use the provided connection object for setting up...
[ "def", "create_table", "(", "self", ",", "engine", ")", ":", "def", "construct_sqla_columns", "(", "columns", ")", ":", "retval", "=", "[", "sqlalchemy", ".", "Column", "(", "*", "c", "[", "0", "]", ",", "*", "*", "c", "[", "1", "]", ")", "for", ...
Override to provide code for creating the target table. By default it will be created using types specified in columns. If the table exists, then it binds to the existing table. If overridden, use the provided connection object for setting up the table in order to create the table and ...
[ "Override", "to", "provide", "code", "for", "creating", "the", "target", "table", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/sqla.py#L318-L357
train
spotify/luigi
luigi/contrib/sqla.py
CopyToTable.copy
def copy(self, conn, ins_rows, table_bound): """ This method does the actual insertion of the rows of data given by ins_rows into the database. A task that needs row updates instead of insertions should overload this method. :param conn: The sqlalchemy connection object :param in...
python
def copy(self, conn, ins_rows, table_bound): """ This method does the actual insertion of the rows of data given by ins_rows into the database. A task that needs row updates instead of insertions should overload this method. :param conn: The sqlalchemy connection object :param in...
[ "def", "copy", "(", "self", ",", "conn", ",", "ins_rows", ",", "table_bound", ")", ":", "bound_cols", "=", "dict", "(", "(", "c", ",", "sqlalchemy", ".", "bindparam", "(", "\"_\"", "+", "c", ".", "key", ")", ")", "for", "c", "in", "table_bound", "....
This method does the actual insertion of the rows of data given by ins_rows into the database. A task that needs row updates instead of insertions should overload this method. :param conn: The sqlalchemy connection object :param ins_rows: The dictionary of rows with the keys in the format _<colu...
[ "This", "method", "does", "the", "actual", "insertion", "of", "the", "rows", "of", "data", "given", "by", "ins_rows", "into", "the", "database", ".", "A", "task", "that", "needs", "row", "updates", "instead", "of", "insertions", "should", "overload", "this",...
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/sqla.py#L400-L413
train
spotify/luigi
luigi/contrib/lsf_runner.py
main
def main(args=sys.argv): """Run the work() method from the class instance in the file "job-instance.pickle". """ try: # Set up logging. logging.basicConfig(level=logging.WARN) work_dir = args[1] assert os.path.exists(work_dir), "First argument to lsf_runner.py must be a direc...
python
def main(args=sys.argv): """Run the work() method from the class instance in the file "job-instance.pickle". """ try: # Set up logging. logging.basicConfig(level=logging.WARN) work_dir = args[1] assert os.path.exists(work_dir), "First argument to lsf_runner.py must be a direc...
[ "def", "main", "(", "args", "=", "sys", ".", "argv", ")", ":", "try", ":", "# Set up logging.", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "WARN", ")", "work_dir", "=", "args", "[", "1", "]", "assert", "os", ".", "path", ".", ...
Run the work() method from the class instance in the file "job-instance.pickle".
[ "Run", "the", "work", "()", "method", "from", "the", "class", "instance", "in", "the", "file", "job", "-", "instance", ".", "pickle", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/lsf_runner.py#L67-L79
train
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
train
spotify/luigi
luigi/contrib/hdfs/target.py
HdfsTarget.move
def move(self, path, raise_if_exists=False): """ Alias for ``rename()`` """ self.rename(path, raise_if_exists=raise_if_exists)
python
def move(self, path, raise_if_exists=False): """ Alias for ``rename()`` """ self.rename(path, raise_if_exists=raise_if_exists)
[ "def", "move", "(", "self", ",", "path", ",", "raise_if_exists", "=", "False", ")", ":", "self", ".", "rename", "(", "path", ",", "raise_if_exists", "=", "raise_if_exists", ")" ]
Alias for ``rename()``
[ "Alias", "for", "rename", "()" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hdfs/target.py#L134-L138
train
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
train
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
train
spotify/luigi
luigi/execution_summary.py
_populate_unknown_statuses
def _populate_unknown_statuses(set_tasks): """ Add the "upstream_*" and "not_run" statuses my mutating set_tasks. """ visited = set() for task in set_tasks["still_pending_not_ext"]: _depth_first_search(set_tasks, task, visited)
python
def _populate_unknown_statuses(set_tasks): """ Add the "upstream_*" and "not_run" statuses my mutating set_tasks. """ visited = set() for task in set_tasks["still_pending_not_ext"]: _depth_first_search(set_tasks, task, visited)
[ "def", "_populate_unknown_statuses", "(", "set_tasks", ")", ":", "visited", "=", "set", "(", ")", "for", "task", "in", "set_tasks", "[", "\"still_pending_not_ext\"", "]", ":", "_depth_first_search", "(", "set_tasks", ",", "task", ",", "visited", ")" ]
Add the "upstream_*" and "not_run" statuses my mutating set_tasks.
[ "Add", "the", "upstream_", "*", "and", "not_run", "statuses", "my", "mutating", "set_tasks", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/execution_summary.py#L125-L131
train
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
train
spotify/luigi
luigi/execution_summary.py
_get_str
def _get_str(task_dict, extra_indent): """ This returns a string for each status """ summary_length = execution_summary().summary_length lines = [] task_names = sorted(task_dict.keys()) for task_family in task_names: tasks = task_dict[task_family] tasks = sorted(tasks, key=l...
python
def _get_str(task_dict, extra_indent): """ This returns a string for each status """ summary_length = execution_summary().summary_length lines = [] task_names = sorted(task_dict.keys()) for task_family in task_names: tasks = task_dict[task_family] tasks = sorted(tasks, key=l...
[ "def", "_get_str", "(", "task_dict", ",", "extra_indent", ")", ":", "summary_length", "=", "execution_summary", "(", ")", ".", "summary_length", "lines", "=", "[", "]", "task_names", "=", "sorted", "(", "task_dict", ".", "keys", "(", ")", ")", "for", "task...
This returns a string for each status
[ "This", "returns", "a", "string", "for", "each", "status" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/execution_summary.py#L165-L222
train
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
train
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
train
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
train
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
train
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
train
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
train
spotify/luigi
luigi/task.py
task_id_str
def task_id_str(task_family, params): """ Returns a canonical string used to identify a particular task :param task_family: The task family (class name) of the task :param params: a dict mapping parameter names to their serialized values :return: A unique, shortened identifier corresponding to the ...
python
def task_id_str(task_family, params): """ Returns a canonical string used to identify a particular task :param task_family: The task family (class name) of the task :param params: a dict mapping parameter names to their serialized values :return: A unique, shortened identifier corresponding to the ...
[ "def", "task_id_str", "(", "task_family", ",", "params", ")", ":", "# task_id is a concatenation of task family, the first values of the first 3 parameters", "# sorted by parameter name and a md5hash of the family/parameters as a cananocalised json.", "param_str", "=", "json", ".", "dump...
Returns a canonical string used to identify a particular task :param task_family: The task family (class name) of the task :param params: a dict mapping parameter names to their serialized values :return: A unique, shortened identifier corresponding to the family and params
[ "Returns", "a", "canonical", "string", "used", "to", "identify", "a", "particular", "task" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/task.py#L120-L137
train
spotify/luigi
luigi/task.py
externalize
def externalize(taskclass_or_taskobject): """ Returns an externalized version of a Task. You may both pass an instantiated task object or a task class. Some examples: .. code-block:: python class RequiringTask(luigi.Task): def requires(self): task_object = self.clon...
python
def externalize(taskclass_or_taskobject): """ Returns an externalized version of a Task. You may both pass an instantiated task object or a task class. Some examples: .. code-block:: python class RequiringTask(luigi.Task): def requires(self): task_object = self.clon...
[ "def", "externalize", "(", "taskclass_or_taskobject", ")", ":", "# Seems like with python < 3.3 copy.copy can't copy classes", "# and objects with specified metaclass http://bugs.python.org/issue11480", "compatible_copy", "=", "copy", ".", "copy", "if", "six", ".", "PY3", "else", ...
Returns an externalized version of a Task. You may both pass an instantiated task object or a task class. Some examples: .. code-block:: python class RequiringTask(luigi.Task): def requires(self): task_object = self.clone(MyTask) return externalize(task_obje...
[ "Returns", "an", "externalized", "version", "of", "a", "Task", ".", "You", "may", "both", "pass", "an", "instantiated", "task", "object", "or", "a", "task", "class", ".", "Some", "examples", ":" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/task.py#L757-L817
train
spotify/luigi
luigi/task.py
getpaths
def getpaths(struct): """ Maps all Tasks in a structured data object to their .output(). """ if isinstance(struct, Task): return struct.output() elif isinstance(struct, dict): return struct.__class__((k, getpaths(v)) for k, v in six.iteritems(struct)) elif isinstance(struct, (lis...
python
def getpaths(struct): """ Maps all Tasks in a structured data object to their .output(). """ if isinstance(struct, Task): return struct.output() elif isinstance(struct, dict): return struct.__class__((k, getpaths(v)) for k, v in six.iteritems(struct)) elif isinstance(struct, (lis...
[ "def", "getpaths", "(", "struct", ")", ":", "if", "isinstance", "(", "struct", ",", "Task", ")", ":", "return", "struct", ".", "output", "(", ")", "elif", "isinstance", "(", "struct", ",", "dict", ")", ":", "return", "struct", ".", "__class__", "(", ...
Maps all Tasks in a structured data object to their .output().
[ "Maps", "all", "Tasks", "in", "a", "structured", "data", "object", "to", "their", ".", "output", "()", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/task.py#L838-L853
train
spotify/luigi
luigi/task.py
flatten
def flatten(struct): """ Creates a flat list of all all items in structured output (dicts, lists, items): .. code-block:: python >>> sorted(flatten({'a': 'foo', 'b': 'bar'})) ['bar', 'foo'] >>> sorted(flatten(['foo', ['bar', 'troll']])) ['bar', 'foo', 'troll'] >>> f...
python
def flatten(struct): """ Creates a flat list of all all items in structured output (dicts, lists, items): .. code-block:: python >>> sorted(flatten({'a': 'foo', 'b': 'bar'})) ['bar', 'foo'] >>> sorted(flatten(['foo', ['bar', 'troll']])) ['bar', 'foo', 'troll'] >>> f...
[ "def", "flatten", "(", "struct", ")", ":", "if", "struct", "is", "None", ":", "return", "[", "]", "flat", "=", "[", "]", "if", "isinstance", "(", "struct", ",", "dict", ")", ":", "for", "_", ",", "result", "in", "six", ".", "iteritems", "(", "str...
Creates a flat list of all all items in structured output (dicts, lists, items): .. code-block:: python >>> sorted(flatten({'a': 'foo', 'b': 'bar'})) ['bar', 'foo'] >>> sorted(flatten(['foo', ['bar', 'troll']])) ['bar', 'foo', 'troll'] >>> flatten('foo') ['foo'] ...
[ "Creates", "a", "flat", "list", "of", "all", "all", "items", "in", "structured", "output", "(", "dicts", "lists", "items", ")", ":" ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/task.py#L856-L889
train
spotify/luigi
luigi/task.py
flatten_output
def flatten_output(task): """ Lists all output targets by recursively walking output-less (wrapper) tasks. FIXME order consistently. """ r = flatten(task.output()) if not r: for dep in flatten(task.requires()): r += flatten_output(dep) return r
python
def flatten_output(task): """ Lists all output targets by recursively walking output-less (wrapper) tasks. FIXME order consistently. """ r = flatten(task.output()) if not r: for dep in flatten(task.requires()): r += flatten_output(dep) return r
[ "def", "flatten_output", "(", "task", ")", ":", "r", "=", "flatten", "(", "task", ".", "output", "(", ")", ")", "if", "not", "r", ":", "for", "dep", "in", "flatten", "(", "task", ".", "requires", "(", ")", ")", ":", "r", "+=", "flatten_output", "...
Lists all output targets by recursively walking output-less (wrapper) tasks. FIXME order consistently.
[ "Lists", "all", "output", "targets", "by", "recursively", "walking", "output", "-", "less", "(", "wrapper", ")", "tasks", "." ]
c5eca1c3c3ee2a7eb612486192a0da146710a1e9
https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/task.py#L892-L902
train