repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
spotify/luigi | luigi/contrib/redshift.py | _CredentialsMixin._credentials | def _credentials(self):
"""
Return a credential string for the provided task. If no valid
credentials are set, raise a NotImplementedError.
"""
if self.aws_account_id and self.aws_arn_role_name:
return 'aws_iam_role=arn:aws:iam::{id}:role/{role}'.format(
... | python | def _credentials(self):
"""
Return a credential string for the provided task. If no valid
credentials are set, raise a NotImplementedError.
"""
if self.aws_account_id and self.aws_arn_role_name:
return 'aws_iam_role=arn:aws:iam::{id}:role/{role}'.format(
... | [
"def",
"_credentials",
"(",
"self",
")",
":",
"if",
"self",
".",
"aws_account_id",
"and",
"self",
".",
"aws_arn_role_name",
":",
"return",
"'aws_iam_role=arn:aws:iam::{id}:role/{role}'",
".",
"format",
"(",
"id",
"=",
"self",
".",
"aws_account_id",
",",
"role",
... | Return a credential string for the provided task. If no valid
credentials are set, raise a NotImplementedError. | [
"Return",
"a",
"credential",
"string",
"for",
"the",
"provided",
"task",
".",
"If",
"no",
"valid",
"credentials",
"are",
"set",
"raise",
"a",
"NotImplementedError",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L100-L123 | train | Return a credential string for the provided task. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/redshift.py | S3CopyToTable.do_prune | def do_prune(self):
"""
Return True if prune_table, prune_column, and prune_date are implemented.
If only a subset of prune variables are override, an exception is raised to remind the user to implement all or none.
Prune (data newer than prune_date deleted) before copying new data in.
... | python | def do_prune(self):
"""
Return True if prune_table, prune_column, and prune_date are implemented.
If only a subset of prune variables are override, an exception is raised to remind the user to implement all or none.
Prune (data newer than prune_date deleted) before copying new data in.
... | [
"def",
"do_prune",
"(",
"self",
")",
":",
"if",
"self",
".",
"prune_table",
"and",
"self",
".",
"prune_column",
"and",
"self",
".",
"prune_date",
":",
"return",
"True",
"elif",
"self",
".",
"prune_table",
"or",
"self",
".",
"prune_column",
"or",
"self",
... | Return True if prune_table, prune_column, and prune_date are implemented.
If only a subset of prune variables are override, an exception is raised to remind the user to implement all or none.
Prune (data newer than prune_date deleted) before copying new data in. | [
"Return",
"True",
"if",
"prune_table",
"prune_column",
"and",
"prune_date",
"are",
"implemented",
".",
"If",
"only",
"a",
"subset",
"of",
"prune",
"variables",
"are",
"override",
"an",
"exception",
"is",
"raised",
"to",
"remind",
"the",
"user",
"to",
"implemen... | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L240-L251 | train | Return True if prune_table prune_column and prune_date are implemented. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/redshift.py | S3CopyToTable.create_schema | def create_schema(self, connection):
"""
Will create the schema in the database
"""
if '.' not in self.table:
return
query = 'CREATE SCHEMA IF NOT EXISTS {schema_name};'.format(schema_name=self.table.split('.')[0])
connection.cursor().execute(query) | python | def create_schema(self, connection):
"""
Will create the schema in the database
"""
if '.' not in self.table:
return
query = 'CREATE SCHEMA IF NOT EXISTS {schema_name};'.format(schema_name=self.table.split('.')[0])
connection.cursor().execute(query) | [
"def",
"create_schema",
"(",
"self",
",",
"connection",
")",
":",
"if",
"'.'",
"not",
"in",
"self",
".",
"table",
":",
"return",
"query",
"=",
"'CREATE SCHEMA IF NOT EXISTS {schema_name};'",
".",
"format",
"(",
"schema_name",
"=",
"self",
".",
"table",
".",
... | Will create the schema in the database | [
"Will",
"create",
"the",
"schema",
"in",
"the",
"database"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L283-L291 | train | Create the schema in the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/redshift.py | S3CopyToTable.create_table | def create_table(self, connection):
"""
Override to provide code for creating the target table.
By default it will be created using types (optionally)
specified in columns.
If overridden, use the provided connection object for
setting up the table in order to create the... | python | def create_table(self, connection):
"""
Override to provide code for creating the target table.
By default it will be created using types (optionally)
specified in columns.
If overridden, use the provided connection object for
setting up the table in order to create the... | [
"def",
"create_table",
"(",
"self",
",",
"connection",
")",
":",
"if",
"len",
"(",
"self",
".",
"columns",
"[",
"0",
"]",
")",
"==",
"1",
":",
"# only names of columns specified, no types",
"raise",
"NotImplementedError",
"(",
"\"create_table() not implemented \"",
... | Override to provide code for creating the target table.
By default it will be created using types (optionally)
specified in columns.
If overridden, use the provided connection object for
setting up the table in order to create the table and
insert data using the same transactio... | [
"Override",
"to",
"provide",
"code",
"for",
"creating",
"the",
"target",
"table",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L293-L357 | train | Creates the target table for the current object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/redshift.py | S3CopyToTable.run | def run(self):
"""
If the target table doesn't exist, self.create_table
will be called to attempt to create the table.
"""
if not (self.table):
raise Exception("table need to be specified")
path = self.s3_load_path()
output = self.output()
con... | python | def run(self):
"""
If the target table doesn't exist, self.create_table
will be called to attempt to create the table.
"""
if not (self.table):
raise Exception("table need to be specified")
path = self.s3_load_path()
output = self.output()
con... | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"not",
"(",
"self",
".",
"table",
")",
":",
"raise",
"Exception",
"(",
"\"table need to be specified\"",
")",
"path",
"=",
"self",
".",
"s3_load_path",
"(",
")",
"output",
"=",
"self",
".",
"output",
"(",
")",... | If the target table doesn't exist, self.create_table
will be called to attempt to create the table. | [
"If",
"the",
"target",
"table",
"doesn",
"t",
"exist",
"self",
".",
"create_table",
"will",
"be",
"called",
"to",
"attempt",
"to",
"create",
"the",
"table",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L359-L384 | train | This method runs the main entry point. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/redshift.py | S3CopyToTable.copy | def copy(self, cursor, f):
"""
Defines copying from s3 into redshift.
If both key-based and role-based credentials are provided, role-based will be used.
"""
logger.info("Inserting file: %s", f)
colnames = ''
if self.columns and len(self.columns) > 0:
... | python | def copy(self, cursor, f):
"""
Defines copying from s3 into redshift.
If both key-based and role-based credentials are provided, role-based will be used.
"""
logger.info("Inserting file: %s", f)
colnames = ''
if self.columns and len(self.columns) > 0:
... | [
"def",
"copy",
"(",
"self",
",",
"cursor",
",",
"f",
")",
":",
"logger",
".",
"info",
"(",
"\"Inserting file: %s\"",
",",
"f",
")",
"colnames",
"=",
"''",
"if",
"self",
".",
"columns",
"and",
"len",
"(",
"self",
".",
"columns",
")",
">",
"0",
":",
... | Defines copying from s3 into redshift.
If both key-based and role-based credentials are provided, role-based will be used. | [
"Defines",
"copying",
"from",
"s3",
"into",
"redshift",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L386-L408 | train | Copy a file into the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/redshift.py | S3CopyToTable.does_schema_exist | def does_schema_exist(self, connection):
"""
Determine whether the schema already exists.
"""
if '.' in self.table:
query = ("select 1 as schema_exists "
"from pg_namespace "
"where nspname = lower(%s) limit 1")
else:
... | python | def does_schema_exist(self, connection):
"""
Determine whether the schema already exists.
"""
if '.' in self.table:
query = ("select 1 as schema_exists "
"from pg_namespace "
"where nspname = lower(%s) limit 1")
else:
... | [
"def",
"does_schema_exist",
"(",
"self",
",",
"connection",
")",
":",
"if",
"'.'",
"in",
"self",
".",
"table",
":",
"query",
"=",
"(",
"\"select 1 as schema_exists \"",
"\"from pg_namespace \"",
"\"where nspname = lower(%s) limit 1\"",
")",
"else",
":",
"return",
"T... | Determine whether the schema already exists. | [
"Determine",
"whether",
"the",
"schema",
"already",
"exists",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L424-L443 | train | Determine whether the schema already exists. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/redshift.py | S3CopyToTable.does_table_exist | def does_table_exist(self, connection):
"""
Determine whether the table already exists.
"""
if '.' in self.table:
query = ("select 1 as table_exists "
"from information_schema.tables "
"where table_schema = lower(%s) and table_name =... | python | def does_table_exist(self, connection):
"""
Determine whether the table already exists.
"""
if '.' in self.table:
query = ("select 1 as table_exists "
"from information_schema.tables "
"where table_schema = lower(%s) and table_name =... | [
"def",
"does_table_exist",
"(",
"self",
",",
"connection",
")",
":",
"if",
"'.'",
"in",
"self",
".",
"table",
":",
"query",
"=",
"(",
"\"select 1 as table_exists \"",
"\"from information_schema.tables \"",
"\"where table_schema = lower(%s) and table_name = lower(%s) limit 1\"... | Determine whether the table already exists. | [
"Determine",
"whether",
"the",
"table",
"already",
"exists",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L445-L464 | train | Determine whether the table exists. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/redshift.py | S3CopyToTable.init_copy | def init_copy(self, connection):
"""
Perform pre-copy sql - such as creating table, truncating, or removing data older than x.
"""
if not self.does_schema_exist(connection):
logger.info("Creating schema for %s", self.table)
self.create_schema(connection)
... | python | def init_copy(self, connection):
"""
Perform pre-copy sql - such as creating table, truncating, or removing data older than x.
"""
if not self.does_schema_exist(connection):
logger.info("Creating schema for %s", self.table)
self.create_schema(connection)
... | [
"def",
"init_copy",
"(",
"self",
",",
"connection",
")",
":",
"if",
"not",
"self",
".",
"does_schema_exist",
"(",
"connection",
")",
":",
"logger",
".",
"info",
"(",
"\"Creating schema for %s\"",
",",
"self",
".",
"table",
")",
"self",
".",
"create_schema",
... | Perform pre-copy sql - such as creating table, truncating, or removing data older than x. | [
"Perform",
"pre",
"-",
"copy",
"sql",
"-",
"such",
"as",
"creating",
"table",
"truncating",
"or",
"removing",
"data",
"older",
"than",
"x",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L466-L487 | train | Perform pre - copy sql - such as creating table truncating table and removing data older than x. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/redshift.py | S3CopyToTable.post_copy | def post_copy(self, cursor):
"""
Performs post-copy sql - such as cleansing data, inserting into production table (if copied to temp table), etc.
"""
logger.info('Executing post copy queries')
for query in self.queries:
cursor.execute(query) | python | def post_copy(self, cursor):
"""
Performs post-copy sql - such as cleansing data, inserting into production table (if copied to temp table), etc.
"""
logger.info('Executing post copy queries')
for query in self.queries:
cursor.execute(query) | [
"def",
"post_copy",
"(",
"self",
",",
"cursor",
")",
":",
"logger",
".",
"info",
"(",
"'Executing post copy queries'",
")",
"for",
"query",
"in",
"self",
".",
"queries",
":",
"cursor",
".",
"execute",
"(",
"query",
")"
] | Performs post-copy sql - such as cleansing data, inserting into production table (if copied to temp table), etc. | [
"Performs",
"post",
"-",
"copy",
"sql",
"-",
"such",
"as",
"cleansing",
"data",
"inserting",
"into",
"production",
"table",
"(",
"if",
"copied",
"to",
"temp",
"table",
")",
"etc",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L489-L495 | train | Executes post - copy queries on the database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/redshift.py | S3CopyToTable.post_copy_metacolums | def post_copy_metacolums(self, cursor):
"""
Performs post-copy to fill metadata columns.
"""
logger.info('Executing post copy metadata queries')
for query in self.metadata_queries:
cursor.execute(query) | python | def post_copy_metacolums(self, cursor):
"""
Performs post-copy to fill metadata columns.
"""
logger.info('Executing post copy metadata queries')
for query in self.metadata_queries:
cursor.execute(query) | [
"def",
"post_copy_metacolums",
"(",
"self",
",",
"cursor",
")",
":",
"logger",
".",
"info",
"(",
"'Executing post copy metadata queries'",
")",
"for",
"query",
"in",
"self",
".",
"metadata_queries",
":",
"cursor",
".",
"execute",
"(",
"query",
")"
] | Performs post-copy to fill metadata columns. | [
"Performs",
"post",
"-",
"copy",
"to",
"fill",
"metadata",
"columns",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L497-L503 | train | Performs post - copy to fill metadata columns. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/redshift.py | S3CopyJSONToTable.copy | def copy(self, cursor, f):
"""
Defines copying JSON from s3 into redshift.
"""
logger.info("Inserting file: %s", f)
cursor.execute("""
COPY %s from '%s'
CREDENTIALS '%s'
JSON AS '%s' %s
%s
;""" % (self.table, f, self._credentials(),
... | python | def copy(self, cursor, f):
"""
Defines copying JSON from s3 into redshift.
"""
logger.info("Inserting file: %s", f)
cursor.execute("""
COPY %s from '%s'
CREDENTIALS '%s'
JSON AS '%s' %s
%s
;""" % (self.table, f, self._credentials(),
... | [
"def",
"copy",
"(",
"self",
",",
"cursor",
",",
"f",
")",
":",
"logger",
".",
"info",
"(",
"\"Inserting file: %s\"",
",",
"f",
")",
"cursor",
".",
"execute",
"(",
"\"\"\"\n COPY %s from '%s'\n CREDENTIALS '%s'\n JSON AS '%s' %s\n %s\n ... | Defines copying JSON from s3 into redshift. | [
"Defines",
"copying",
"JSON",
"from",
"s3",
"into",
"redshift",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L546-L558 | train | Copy a file from s3 into redshift. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/redshift.py | KillOpenRedshiftSessions.output | def output(self):
"""
Returns a RedshiftTarget representing the inserted dataset.
Normally you don't override this.
"""
# uses class name as a meta-table
return RedshiftTarget(
host=self.host,
database=self.database,
user=self.user,
... | python | def output(self):
"""
Returns a RedshiftTarget representing the inserted dataset.
Normally you don't override this.
"""
# uses class name as a meta-table
return RedshiftTarget(
host=self.host,
database=self.database,
user=self.user,
... | [
"def",
"output",
"(",
"self",
")",
":",
"# uses class name as a meta-table",
"return",
"RedshiftTarget",
"(",
"host",
"=",
"self",
".",
"host",
",",
"database",
"=",
"self",
".",
"database",
",",
"user",
"=",
"self",
".",
"user",
",",
"password",
"=",
"sel... | Returns a RedshiftTarget representing the inserted dataset.
Normally you don't override this. | [
"Returns",
"a",
"RedshiftTarget",
"representing",
"the",
"inserted",
"dataset",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L649-L662 | train | Returns a RedshiftTarget representing the inserted dataset. Normally you don t override this. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/redshift.py | KillOpenRedshiftSessions.run | def run(self):
"""
Kill any open Redshift sessions for the given database.
"""
connection = self.output().connect()
# kill any sessions other than ours and
# internal Redshift sessions (rdsdb)
query = ("select pg_terminate_backend(process) "
"from... | python | def run(self):
"""
Kill any open Redshift sessions for the given database.
"""
connection = self.output().connect()
# kill any sessions other than ours and
# internal Redshift sessions (rdsdb)
query = ("select pg_terminate_backend(process) "
"from... | [
"def",
"run",
"(",
"self",
")",
":",
"connection",
"=",
"self",
".",
"output",
"(",
")",
".",
"connect",
"(",
")",
"# kill any sessions other than ours and",
"# internal Redshift sessions (rdsdb)",
"query",
"=",
"(",
"\"select pg_terminate_backend(process) \"",
"\"from ... | Kill any open Redshift sessions for the given database. | [
"Kill",
"any",
"open",
"Redshift",
"sessions",
"for",
"the",
"given",
"database",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/redshift.py#L664-L701 | train | Kill any open Redshift sessions for the given database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/date_interval.py | DateInterval.dates | def dates(self):
''' Returns a list of dates in this date interval.'''
dates = []
d = self.date_a
while d < self.date_b:
dates.append(d)
d += datetime.timedelta(1)
return dates | python | def dates(self):
''' Returns a list of dates in this date interval.'''
dates = []
d = self.date_a
while d < self.date_b:
dates.append(d)
d += datetime.timedelta(1)
return dates | [
"def",
"dates",
"(",
"self",
")",
":",
"dates",
"=",
"[",
"]",
"d",
"=",
"self",
".",
"date_a",
"while",
"d",
"<",
"self",
".",
"date_b",
":",
"dates",
".",
"append",
"(",
"d",
")",
"d",
"+=",
"datetime",
".",
"timedelta",
"(",
"1",
")",
"retur... | Returns a list of dates in this date interval. | [
"Returns",
"a",
"list",
"of",
"dates",
"in",
"this",
"date",
"interval",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/date_interval.py#L67-L75 | train | Returns a list of dates in this date interval. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/date_interval.py | DateInterval.hours | def hours(self):
''' Same as dates() but returns 24 times more info: one for each hour.'''
for date in self.dates():
for hour in xrange(24):
yield datetime.datetime.combine(date, datetime.time(hour)) | python | def hours(self):
''' Same as dates() but returns 24 times more info: one for each hour.'''
for date in self.dates():
for hour in xrange(24):
yield datetime.datetime.combine(date, datetime.time(hour)) | [
"def",
"hours",
"(",
"self",
")",
":",
"for",
"date",
"in",
"self",
".",
"dates",
"(",
")",
":",
"for",
"hour",
"in",
"xrange",
"(",
"24",
")",
":",
"yield",
"datetime",
".",
"datetime",
".",
"combine",
"(",
"date",
",",
"datetime",
".",
"time",
... | Same as dates() but returns 24 times more info: one for each hour. | [
"Same",
"as",
"dates",
"()",
"but",
"returns",
"24",
"times",
"more",
"info",
":",
"one",
"for",
"each",
"hour",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/date_interval.py#L77-L81 | train | Returns a generator that yields the 24 times more info for each hour. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | examples/ftp_experiment_outputs.py | ExperimentTask.run | def run(self):
"""
The execution of this task will write 4 lines of data on this task's target output.
"""
with self.output().open('w') as outfile:
print("data 0 200 10 50 60", file=outfile)
print("data 1 190 9 52 60", file=outfile)
print("data 2 200 1... | python | def run(self):
"""
The execution of this task will write 4 lines of data on this task's target output.
"""
with self.output().open('w') as outfile:
print("data 0 200 10 50 60", file=outfile)
print("data 1 190 9 52 60", file=outfile)
print("data 2 200 1... | [
"def",
"run",
"(",
"self",
")",
":",
"with",
"self",
".",
"output",
"(",
")",
".",
"open",
"(",
"'w'",
")",
"as",
"outfile",
":",
"print",
"(",
"\"data 0 200 10 50 60\"",
",",
"file",
"=",
"outfile",
")",
"print",
"(",
"\"data 1 190 9 52 60\"",
",",
"f... | The execution of this task will write 4 lines of data on this task's target output. | [
"The",
"execution",
"of",
"this",
"task",
"will",
"write",
"4",
"lines",
"of",
"data",
"on",
"this",
"task",
"s",
"target",
"output",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/examples/ftp_experiment_outputs.py#L46-L54 | train | This method is called by the base class to write the data to the target output file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/mock.py | MockFileSystem.copy | def copy(self, path, dest, raise_if_exists=False):
"""
Copies the contents of a single file path to dest
"""
if raise_if_exists and dest in self.get_all_data():
raise RuntimeError('Destination exists: %s' % path)
contents = self.get_all_data()[path]
self.get_a... | python | def copy(self, path, dest, raise_if_exists=False):
"""
Copies the contents of a single file path to dest
"""
if raise_if_exists and dest in self.get_all_data():
raise RuntimeError('Destination exists: %s' % path)
contents = self.get_all_data()[path]
self.get_a... | [
"def",
"copy",
"(",
"self",
",",
"path",
",",
"dest",
",",
"raise_if_exists",
"=",
"False",
")",
":",
"if",
"raise_if_exists",
"and",
"dest",
"in",
"self",
".",
"get_all_data",
"(",
")",
":",
"raise",
"RuntimeError",
"(",
"'Destination exists: %s'",
"%",
"... | Copies the contents of a single file path to dest | [
"Copies",
"the",
"contents",
"of",
"a",
"single",
"file",
"path",
"to",
"dest"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/mock.py#L40-L47 | train | Copies the contents of a single file path to dest. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/mock.py | MockFileSystem.remove | def remove(self, path, recursive=True, skip_trash=True):
"""
Removes the given mockfile. skip_trash doesn't have any meaning.
"""
if recursive:
to_delete = []
for s in self.get_all_data().keys():
if s.startswith(path):
to_delete... | python | def remove(self, path, recursive=True, skip_trash=True):
"""
Removes the given mockfile. skip_trash doesn't have any meaning.
"""
if recursive:
to_delete = []
for s in self.get_all_data().keys():
if s.startswith(path):
to_delete... | [
"def",
"remove",
"(",
"self",
",",
"path",
",",
"recursive",
"=",
"True",
",",
"skip_trash",
"=",
"True",
")",
":",
"if",
"recursive",
":",
"to_delete",
"=",
"[",
"]",
"for",
"s",
"in",
"self",
".",
"get_all_data",
"(",
")",
".",
"keys",
"(",
")",
... | Removes the given mockfile. skip_trash doesn't have any meaning. | [
"Removes",
"the",
"given",
"mockfile",
".",
"skip_trash",
"doesn",
"t",
"have",
"any",
"meaning",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/mock.py#L61-L73 | train | Removes the given mockfile. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/mock.py | MockFileSystem.move | def move(self, path, dest, raise_if_exists=False):
"""
Moves a single file from path to dest
"""
if raise_if_exists and dest in self.get_all_data():
raise RuntimeError('Destination exists: %s' % path)
contents = self.get_all_data().pop(path)
self.get_all_data(... | python | def move(self, path, dest, raise_if_exists=False):
"""
Moves a single file from path to dest
"""
if raise_if_exists and dest in self.get_all_data():
raise RuntimeError('Destination exists: %s' % path)
contents = self.get_all_data().pop(path)
self.get_all_data(... | [
"def",
"move",
"(",
"self",
",",
"path",
",",
"dest",
",",
"raise_if_exists",
"=",
"False",
")",
":",
"if",
"raise_if_exists",
"and",
"dest",
"in",
"self",
".",
"get_all_data",
"(",
")",
":",
"raise",
"RuntimeError",
"(",
"'Destination exists: %s'",
"%",
"... | Moves a single file from path to dest | [
"Moves",
"a",
"single",
"file",
"from",
"path",
"to",
"dest"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/mock.py#L75-L82 | train | Moves a single file from path to dest. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/mock.py | MockFileSystem.listdir | def listdir(self, path):
"""
listdir does a prefix match of self.get_all_data(), but doesn't yet support globs.
"""
return [s for s in self.get_all_data().keys()
if s.startswith(path)] | python | def listdir(self, path):
"""
listdir does a prefix match of self.get_all_data(), but doesn't yet support globs.
"""
return [s for s in self.get_all_data().keys()
if s.startswith(path)] | [
"def",
"listdir",
"(",
"self",
",",
"path",
")",
":",
"return",
"[",
"s",
"for",
"s",
"in",
"self",
".",
"get_all_data",
"(",
")",
".",
"keys",
"(",
")",
"if",
"s",
".",
"startswith",
"(",
"path",
")",
"]"
] | listdir does a prefix match of self.get_all_data(), but doesn't yet support globs. | [
"listdir",
"does",
"a",
"prefix",
"match",
"of",
"self",
".",
"get_all_data",
"()",
"but",
"doesn",
"t",
"yet",
"support",
"globs",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/mock.py#L84-L89 | train | listdir - Returns a list of all the directories in the cache | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/mock.py | MockTarget.move | def move(self, path, raise_if_exists=False):
"""
Call MockFileSystem's move command
"""
self.fs.move(self.path, path, raise_if_exists) | python | def move(self, path, raise_if_exists=False):
"""
Call MockFileSystem's move command
"""
self.fs.move(self.path, path, raise_if_exists) | [
"def",
"move",
"(",
"self",
",",
"path",
",",
"raise_if_exists",
"=",
"False",
")",
":",
"self",
".",
"fs",
".",
"move",
"(",
"self",
".",
"path",
",",
"path",
",",
"raise_if_exists",
")"
] | Call MockFileSystem's move command | [
"Call",
"MockFileSystem",
"s",
"move",
"command"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/mock.py#L122-L126 | train | Move the containing file to the given path. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/parameter.py | _recursively_freeze | def _recursively_freeze(value):
"""
Recursively walks ``Mapping``s and ``list``s and converts them to ``_FrozenOrderedDict`` and ``tuples``, respectively.
"""
if isinstance(value, Mapping):
return _FrozenOrderedDict(((k, _recursively_freeze(v)) for k, v in value.items()))
elif isinstance(val... | python | def _recursively_freeze(value):
"""
Recursively walks ``Mapping``s and ``list``s and converts them to ``_FrozenOrderedDict`` and ``tuples``, respectively.
"""
if isinstance(value, Mapping):
return _FrozenOrderedDict(((k, _recursively_freeze(v)) for k, v in value.items()))
elif isinstance(val... | [
"def",
"_recursively_freeze",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Mapping",
")",
":",
"return",
"_FrozenOrderedDict",
"(",
"(",
"(",
"k",
",",
"_recursively_freeze",
"(",
"v",
")",
")",
"for",
"k",
",",
"v",
"in",
"value",
"... | Recursively walks ``Mapping``s and ``list``s and converts them to ``_FrozenOrderedDict`` and ``tuples``, respectively. | [
"Recursively",
"walks",
"Mapping",
"s",
"and",
"list",
"s",
"and",
"converts",
"them",
"to",
"_FrozenOrderedDict",
"and",
"tuples",
"respectively",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L929-L937 | train | Recursively walks a mapping and lists and converts them to _FrozenOrderedDict and tuples respectively. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/parameter.py | Parameter._get_value_from_config | def _get_value_from_config(self, section, name):
"""Loads the default from the config. Returns _no_value if it doesn't exist"""
conf = configuration.get_config()
try:
value = conf.get(section, name)
except (NoSectionError, NoOptionError, KeyError):
return _no_va... | python | def _get_value_from_config(self, section, name):
"""Loads the default from the config. Returns _no_value if it doesn't exist"""
conf = configuration.get_config()
try:
value = conf.get(section, name)
except (NoSectionError, NoOptionError, KeyError):
return _no_va... | [
"def",
"_get_value_from_config",
"(",
"self",
",",
"section",
",",
"name",
")",
":",
"conf",
"=",
"configuration",
".",
"get_config",
"(",
")",
"try",
":",
"value",
"=",
"conf",
".",
"get",
"(",
"section",
",",
"name",
")",
"except",
"(",
"NoSectionError... | Loads the default from the config. Returns _no_value if it doesn't exist | [
"Loads",
"the",
"default",
"from",
"the",
"config",
".",
"Returns",
"_no_value",
"if",
"it",
"doesn",
"t",
"exist"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L192-L202 | train | Loads the default value from the config. Returns _no_value if it doesn t exist. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/parameter.py | Parameter._value_iterator | def _value_iterator(self, task_name, param_name):
"""
Yield the parameter values, with optional deprecation warning as second tuple value.
The parameter value will be whatever non-_no_value that is yielded first.
"""
cp_parser = CmdlineParser.get_instance()
if cp_parser:... | python | def _value_iterator(self, task_name, param_name):
"""
Yield the parameter values, with optional deprecation warning as second tuple value.
The parameter value will be whatever non-_no_value that is yielded first.
"""
cp_parser = CmdlineParser.get_instance()
if cp_parser:... | [
"def",
"_value_iterator",
"(",
"self",
",",
"task_name",
",",
"param_name",
")",
":",
"cp_parser",
"=",
"CmdlineParser",
".",
"get_instance",
"(",
")",
"if",
"cp_parser",
":",
"dest",
"=",
"self",
".",
"_parser_global_dest",
"(",
"param_name",
",",
"task_name"... | Yield the parameter values, with optional deprecation warning as second tuple value.
The parameter value will be whatever non-_no_value that is yielded first. | [
"Yield",
"the",
"parameter",
"values",
"with",
"optional",
"deprecation",
"warning",
"as",
"second",
"tuple",
"value",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L212-L228 | train | Yields the values of the given task and parameter. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/parameter.py | Parameter._parse_list | def _parse_list(self, xs):
"""
Parse a list of values from the scheduler.
Only possible if this is_batchable() is True. This will combine the list into a single
parameter value using batch method. This should never need to be overridden.
:param xs: list of values to parse and c... | python | def _parse_list(self, xs):
"""
Parse a list of values from the scheduler.
Only possible if this is_batchable() is True. This will combine the list into a single
parameter value using batch method. This should never need to be overridden.
:param xs: list of values to parse and c... | [
"def",
"_parse_list",
"(",
"self",
",",
"xs",
")",
":",
"if",
"not",
"self",
".",
"_is_batchable",
"(",
")",
":",
"raise",
"NotImplementedError",
"(",
"'No batch method found'",
")",
"elif",
"not",
"xs",
":",
"raise",
"ValueError",
"(",
"'Empty parameter list ... | Parse a list of values from the scheduler.
Only possible if this is_batchable() is True. This will combine the list into a single
parameter value using batch method. This should never need to be overridden.
:param xs: list of values to parse and combine
:return: the combined parsed val... | [
"Parse",
"a",
"list",
"of",
"values",
"from",
"the",
"scheduler",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L255-L270 | train | Parse a list of values from the scheduler. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/parameter.py | _DateParameterBase.parse | def parse(self, s):
"""
Parses a date string formatted like ``YYYY-MM-DD``.
"""
return datetime.datetime.strptime(s, self.date_format).date() | python | def parse(self, s):
"""
Parses a date string formatted like ``YYYY-MM-DD``.
"""
return datetime.datetime.strptime(s, self.date_format).date() | [
"def",
"parse",
"(",
"self",
",",
"s",
")",
":",
"return",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"s",
",",
"self",
".",
"date_format",
")",
".",
"date",
"(",
")"
] | Parses a date string formatted like ``YYYY-MM-DD``. | [
"Parses",
"a",
"date",
"string",
"formatted",
"like",
"YYYY",
"-",
"MM",
"-",
"DD",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L373-L377 | train | Parses a date string formatted like YYYY - MM - DD. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/parameter.py | _DateParameterBase.serialize | def serialize(self, dt):
"""
Converts the date to a string using the :py:attr:`~_DateParameterBase.date_format`.
"""
if dt is None:
return str(dt)
return dt.strftime(self.date_format) | python | def serialize(self, dt):
"""
Converts the date to a string using the :py:attr:`~_DateParameterBase.date_format`.
"""
if dt is None:
return str(dt)
return dt.strftime(self.date_format) | [
"def",
"serialize",
"(",
"self",
",",
"dt",
")",
":",
"if",
"dt",
"is",
"None",
":",
"return",
"str",
"(",
"dt",
")",
"return",
"dt",
".",
"strftime",
"(",
"self",
".",
"date_format",
")"
] | Converts the date to a string using the :py:attr:`~_DateParameterBase.date_format`. | [
"Converts",
"the",
"date",
"to",
"a",
"string",
"using",
"the",
":",
"py",
":",
"attr",
":",
"~_DateParameterBase",
".",
"date_format",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L379-L385 | train | Converts the date to a string using the date_format attribute. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/parameter.py | MonthParameter._add_months | def _add_months(self, date, months):
"""
Add ``months`` months to ``date``.
Unfortunately we can't use timedeltas to add months because timedelta counts in days
and there's no foolproof way to add N months in days without counting the number of
days per month.
"""
... | python | def _add_months(self, date, months):
"""
Add ``months`` months to ``date``.
Unfortunately we can't use timedeltas to add months because timedelta counts in days
and there's no foolproof way to add N months in days without counting the number of
days per month.
"""
... | [
"def",
"_add_months",
"(",
"self",
",",
"date",
",",
"months",
")",
":",
"year",
"=",
"date",
".",
"year",
"+",
"(",
"date",
".",
"month",
"+",
"months",
"-",
"1",
")",
"//",
"12",
"month",
"=",
"(",
"date",
".",
"month",
"+",
"months",
"-",
"1... | Add ``months`` months to ``date``.
Unfortunately we can't use timedeltas to add months because timedelta counts in days
and there's no foolproof way to add N months in days without counting the number of
days per month. | [
"Add",
"months",
"months",
"to",
"date",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L447-L457 | train | Add months to date. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/parameter.py | _DatetimeParameterBase.normalize | def normalize(self, dt):
"""
Clamp dt to every Nth :py:attr:`~_DatetimeParameterBase.interval` starting at
:py:attr:`~_DatetimeParameterBase.start`.
"""
if dt is None:
return None
dt = self._convert_to_dt(dt)
dt = dt.replace(microsecond=0) # remove ... | python | def normalize(self, dt):
"""
Clamp dt to every Nth :py:attr:`~_DatetimeParameterBase.interval` starting at
:py:attr:`~_DatetimeParameterBase.start`.
"""
if dt is None:
return None
dt = self._convert_to_dt(dt)
dt = dt.replace(microsecond=0) # remove ... | [
"def",
"normalize",
"(",
"self",
",",
"dt",
")",
":",
"if",
"dt",
"is",
"None",
":",
"return",
"None",
"dt",
"=",
"self",
".",
"_convert_to_dt",
"(",
"dt",
")",
"dt",
"=",
"dt",
".",
"replace",
"(",
"microsecond",
"=",
"0",
")",
"# remove microsecond... | Clamp dt to every Nth :py:attr:`~_DatetimeParameterBase.interval` starting at
:py:attr:`~_DatetimeParameterBase.start`. | [
"Clamp",
"dt",
"to",
"every",
"Nth",
":",
"py",
":",
"attr",
":",
"~_DatetimeParameterBase",
".",
"interval",
"starting",
"at",
":",
"py",
":",
"attr",
":",
"~_DatetimeParameterBase",
".",
"start",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L544-L557 | train | Clamp dt to every Nth : py : attr : ~_DatetimeParameterBase. interval starting at self. start. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/parameter.py | BoolParameter.parse | def parse(self, val):
"""
Parses a ``bool`` from the string, matching 'true' or 'false' ignoring case.
"""
s = str(val).lower()
if s == "true":
return True
elif s == "false":
return False
else:
raise ValueError("cannot interpret... | python | def parse(self, val):
"""
Parses a ``bool`` from the string, matching 'true' or 'false' ignoring case.
"""
s = str(val).lower()
if s == "true":
return True
elif s == "false":
return False
else:
raise ValueError("cannot interpret... | [
"def",
"parse",
"(",
"self",
",",
"val",
")",
":",
"s",
"=",
"str",
"(",
"val",
")",
".",
"lower",
"(",
")",
"if",
"s",
"==",
"\"true\"",
":",
"return",
"True",
"elif",
"s",
"==",
"\"false\"",
":",
"return",
"False",
"else",
":",
"raise",
"ValueE... | Parses a ``bool`` from the string, matching 'true' or 'false' ignoring case. | [
"Parses",
"a",
"bool",
"from",
"the",
"string",
"matching",
"true",
"or",
"false",
"ignoring",
"case",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L686-L696 | train | Parses a bool from the string matching true or false ignoring case. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/parameter.py | DateIntervalParameter.parse | def parse(self, s):
"""
Parses a :py:class:`~luigi.date_interval.DateInterval` from the input.
see :py:mod:`luigi.date_interval`
for details on the parsing of DateIntervals.
"""
# TODO: can we use xml.utils.iso8601 or something similar?
from luigi import date_... | python | def parse(self, s):
"""
Parses a :py:class:`~luigi.date_interval.DateInterval` from the input.
see :py:mod:`luigi.date_interval`
for details on the parsing of DateIntervals.
"""
# TODO: can we use xml.utils.iso8601 or something similar?
from luigi import date_... | [
"def",
"parse",
"(",
"self",
",",
"s",
")",
":",
"# TODO: can we use xml.utils.iso8601 or something similar?",
"from",
"luigi",
"import",
"date_interval",
"as",
"d",
"for",
"cls",
"in",
"[",
"d",
".",
"Year",
",",
"d",
".",
"Month",
",",
"d",
".",
"Week",
... | Parses a :py:class:`~luigi.date_interval.DateInterval` from the input.
see :py:mod:`luigi.date_interval`
for details on the parsing of DateIntervals. | [
"Parses",
"a",
":",
"py",
":",
"class",
":",
"~luigi",
".",
"date_interval",
".",
"DateInterval",
"from",
"the",
"input",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L726-L742 | train | Parses a luigi. date_interval. DateInterval from the input string and returns a luigi. date_interval. DatetimeInterval object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/parameter.py | TimeDeltaParameter.parse | def parse(self, input):
"""
Parses a time delta from the input.
See :py:class:`TimeDeltaParameter` for details on supported formats.
"""
result = self._parseIso8601(input)
if not result:
result = self._parseSimple(input)
if result is not None:
... | python | def parse(self, input):
"""
Parses a time delta from the input.
See :py:class:`TimeDeltaParameter` for details on supported formats.
"""
result = self._parseIso8601(input)
if not result:
result = self._parseSimple(input)
if result is not None:
... | [
"def",
"parse",
"(",
"self",
",",
"input",
")",
":",
"result",
"=",
"self",
".",
"_parseIso8601",
"(",
"input",
")",
"if",
"not",
"result",
":",
"result",
"=",
"self",
".",
"_parseSimple",
"(",
"input",
")",
"if",
"result",
"is",
"not",
"None",
":",
... | Parses a time delta from the input.
See :py:class:`TimeDeltaParameter` for details on supported formats. | [
"Parses",
"a",
"time",
"delta",
"from",
"the",
"input",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L790-L802 | train | Parses a time delta from the input. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/parameter.py | TimeDeltaParameter.serialize | def serialize(self, x):
"""
Converts datetime.timedelta to a string
:param x: the value to serialize.
"""
weeks = x.days // 7
days = x.days % 7
hours = x.seconds // 3600
minutes = (x.seconds % 3600) // 60
seconds = (x.seconds % 3600) % 60
... | python | def serialize(self, x):
"""
Converts datetime.timedelta to a string
:param x: the value to serialize.
"""
weeks = x.days // 7
days = x.days % 7
hours = x.seconds // 3600
minutes = (x.seconds % 3600) // 60
seconds = (x.seconds % 3600) % 60
... | [
"def",
"serialize",
"(",
"self",
",",
"x",
")",
":",
"weeks",
"=",
"x",
".",
"days",
"//",
"7",
"days",
"=",
"x",
".",
"days",
"%",
"7",
"hours",
"=",
"x",
".",
"seconds",
"//",
"3600",
"minutes",
"=",
"(",
"x",
".",
"seconds",
"%",
"3600",
"... | Converts datetime.timedelta to a string
:param x: the value to serialize. | [
"Converts",
"datetime",
".",
"timedelta",
"to",
"a",
"string"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L804-L816 | train | Converts datetime. timedelta to a string | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/parameter.py | TupleParameter.parse | def parse(self, x):
"""
Parse an individual value from the input.
:param str x: the value to parse.
:return: the parsed value.
"""
# Since the result of json.dumps(tuple) differs from a tuple string, we must handle either case.
# A tuple string may come from a co... | python | def parse(self, x):
"""
Parse an individual value from the input.
:param str x: the value to parse.
:return: the parsed value.
"""
# Since the result of json.dumps(tuple) differs from a tuple string, we must handle either case.
# A tuple string may come from a co... | [
"def",
"parse",
"(",
"self",
",",
"x",
")",
":",
"# Since the result of json.dumps(tuple) differs from a tuple string, we must handle either case.",
"# A tuple string may come from a config file or from cli execution.",
"# t = ((1, 2), (3, 4))",
"# t_str = '((1,2),(3,4))'",
"# t_json_str = j... | Parse an individual value from the input.
:param str x: the value to parse.
:return: the parsed value. | [
"Parse",
"an",
"individual",
"value",
"from",
"the",
"input",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/parameter.py#L1096-L1119 | train | Parse an individual value from the input. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | examples/wordcount.py | WordCount.run | def run(self):
"""
1. count the words for each of the :py:meth:`~.InputText.output` targets created by :py:class:`~.InputText`
2. write the count into the :py:meth:`~.WordCount.output` target
"""
count = {}
# NOTE: self.input() actually returns an element for the InputTe... | python | def run(self):
"""
1. count the words for each of the :py:meth:`~.InputText.output` targets created by :py:class:`~.InputText`
2. write the count into the :py:meth:`~.WordCount.output` target
"""
count = {}
# NOTE: self.input() actually returns an element for the InputTe... | [
"def",
"run",
"(",
"self",
")",
":",
"count",
"=",
"{",
"}",
"# NOTE: self.input() actually returns an element for the InputText.output() target",
"for",
"f",
"in",
"self",
".",
"input",
"(",
")",
":",
"# The input() method is a wrapper around requires() that returns Target o... | 1. count the words for each of the :py:meth:`~.InputText.output` targets created by :py:class:`~.InputText`
2. write the count into the :py:meth:`~.WordCount.output` target | [
"1",
".",
"count",
"the",
"words",
"for",
"each",
"of",
"the",
":",
"py",
":",
"meth",
":",
"~",
".",
"InputText",
".",
"output",
"targets",
"created",
"by",
":",
"py",
":",
"class",
":",
"~",
".",
"InputText",
"2",
".",
"write",
"the",
"count",
... | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/examples/wordcount.py#L63-L80 | train | Run the count of words for each of the target objects created by this class. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | create_packages_archive | def create_packages_archive(packages, filename):
"""
Create a tar archive which will contain the files for the packages listed in packages.
"""
import tarfile
tar = tarfile.open(filename, "w")
def add(src, dst):
logger.debug('adding to tar: %s -> %s', src, dst)
tar.add(src, dst)... | python | def create_packages_archive(packages, filename):
"""
Create a tar archive which will contain the files for the packages listed in packages.
"""
import tarfile
tar = tarfile.open(filename, "w")
def add(src, dst):
logger.debug('adding to tar: %s -> %s', src, dst)
tar.add(src, dst)... | [
"def",
"create_packages_archive",
"(",
"packages",
",",
"filename",
")",
":",
"import",
"tarfile",
"tar",
"=",
"tarfile",
".",
"open",
"(",
"filename",
",",
"\"w\"",
")",
"def",
"add",
"(",
"src",
",",
"dst",
")",
":",
"logger",
".",
"debug",
"(",
"'ad... | Create a tar archive which will contain the files for the packages listed in packages. | [
"Create",
"a",
"tar",
"archive",
"which",
"will",
"contain",
"the",
"files",
"for",
"the",
"packages",
"listed",
"in",
"packages",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L124-L194 | train | Create a tar archive containing the files for the packages listed in packages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | flatten | def flatten(sequence):
"""
A simple generator which flattens a sequence.
Only one level is flattened.
.. code-block:: python
(1, (2, 3), 4) -> (1, 2, 3, 4)
"""
for item in sequence:
if hasattr(item, "__iter__") and not isinstance(item, str) and not isinstance(item, bytes):
... | python | def flatten(sequence):
"""
A simple generator which flattens a sequence.
Only one level is flattened.
.. code-block:: python
(1, (2, 3), 4) -> (1, 2, 3, 4)
"""
for item in sequence:
if hasattr(item, "__iter__") and not isinstance(item, str) and not isinstance(item, bytes):
... | [
"def",
"flatten",
"(",
"sequence",
")",
":",
"for",
"item",
"in",
"sequence",
":",
"if",
"hasattr",
"(",
"item",
",",
"\"__iter__\"",
")",
"and",
"not",
"isinstance",
"(",
"item",
",",
"str",
")",
"and",
"not",
"isinstance",
"(",
"item",
",",
"bytes",
... | A simple generator which flattens a sequence.
Only one level is flattened.
.. code-block:: python
(1, (2, 3), 4) -> (1, 2, 3, 4) | [
"A",
"simple",
"generator",
"which",
"flattens",
"a",
"sequence",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L197-L213 | train | A simple generator which flattens a sequence. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | run_and_track_hadoop_job | def run_and_track_hadoop_job(arglist, tracking_url_callback=None, env=None):
"""
Runs the job by invoking the command from the given arglist.
Finds tracking urls from the output and attempts to fetch errors using those urls if the job fails.
Throws HadoopJobError with information about the error
(in... | python | def run_and_track_hadoop_job(arglist, tracking_url_callback=None, env=None):
"""
Runs the job by invoking the command from the given arglist.
Finds tracking urls from the output and attempts to fetch errors using those urls if the job fails.
Throws HadoopJobError with information about the error
(in... | [
"def",
"run_and_track_hadoop_job",
"(",
"arglist",
",",
"tracking_url_callback",
"=",
"None",
",",
"env",
"=",
"None",
")",
":",
"logger",
".",
"info",
"(",
"'%s'",
",",
"subprocess",
".",
"list2cmdline",
"(",
"arglist",
")",
")",
"def",
"write_luigi_history",... | Runs the job by invoking the command from the given arglist.
Finds tracking urls from the output and attempts to fetch errors using those urls if the job fails.
Throws HadoopJobError with information about the error
(including stdout and stderr from the process)
on failure and returns normally otherwise... | [
"Runs",
"the",
"job",
"by",
"invoking",
"the",
"command",
"from",
"the",
"given",
"arglist",
".",
"Finds",
"tracking",
"urls",
"from",
"the",
"output",
"and",
"attempts",
"to",
"fetch",
"errors",
"using",
"those",
"urls",
"if",
"the",
"job",
"fails",
".",
... | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L256-L353 | train | Runs a job and tracks it. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | fetch_task_failures | def fetch_task_failures(tracking_url):
"""
Uses mechanize to fetch the actual task logs from the task tracker.
This is highly opportunistic, and we might not succeed.
So we set a low timeout and hope it works.
If it does not, it's not the end of the world.
TODO: Yarn has a REST API that we sho... | python | def fetch_task_failures(tracking_url):
"""
Uses mechanize to fetch the actual task logs from the task tracker.
This is highly opportunistic, and we might not succeed.
So we set a low timeout and hope it works.
If it does not, it's not the end of the world.
TODO: Yarn has a REST API that we sho... | [
"def",
"fetch_task_failures",
"(",
"tracking_url",
")",
":",
"import",
"mechanize",
"timeout",
"=",
"3.0",
"failures_url",
"=",
"tracking_url",
".",
"replace",
"(",
"'jobdetails.jsp'",
",",
"'jobfailures.jsp'",
")",
"+",
"'&cause=failed'",
"logger",
".",
"debug",
... | Uses mechanize to fetch the actual task logs from the task tracker.
This is highly opportunistic, and we might not succeed.
So we set a low timeout and hope it works.
If it does not, it's not the end of the world.
TODO: Yarn has a REST API that we should probably use instead:
http://hadoop.apache.... | [
"Uses",
"mechanize",
"to",
"fetch",
"the",
"actual",
"task",
"logs",
"from",
"the",
"task",
"tracker",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L356-L391 | train | Fetch the actual task logs from the task tracker. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | BaseHadoopJobTask._get_pool | def _get_pool(self):
""" Protected method """
if self.pool:
return self.pool
if hadoop().pool:
return hadoop().pool | python | def _get_pool(self):
""" Protected method """
if self.pool:
return self.pool
if hadoop().pool:
return hadoop().pool | [
"def",
"_get_pool",
"(",
"self",
")",
":",
"if",
"self",
".",
"pool",
":",
"return",
"self",
".",
"pool",
"if",
"hadoop",
"(",
")",
".",
"pool",
":",
"return",
"hadoop",
"(",
")",
".",
"pool"
] | Protected method | [
"Protected",
"method"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L688-L693 | train | Protected method to get the pool name | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | JobTask.job_runner | def job_runner(self):
# We recommend that you define a subclass, override this method and set up your own config
"""
Get the MapReduce runner for this job.
If all outputs are HdfsTargets, the DefaultHadoopJobRunner will be used.
Otherwise, the LocalJobRunner which streams all da... | python | def job_runner(self):
# We recommend that you define a subclass, override this method and set up your own config
"""
Get the MapReduce runner for this job.
If all outputs are HdfsTargets, the DefaultHadoopJobRunner will be used.
Otherwise, the LocalJobRunner which streams all da... | [
"def",
"job_runner",
"(",
"self",
")",
":",
"# We recommend that you define a subclass, override this method and set up your own config",
"outputs",
"=",
"luigi",
".",
"task",
".",
"flatten",
"(",
"self",
".",
"output",
"(",
")",
")",
"for",
"output",
"in",
"outputs",... | Get the MapReduce runner for this job.
If all outputs are HdfsTargets, the DefaultHadoopJobRunner will be used.
Otherwise, the LocalJobRunner which streams all data through the local machine
will be used (great for testing). | [
"Get",
"the",
"MapReduce",
"runner",
"for",
"this",
"job",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L813-L829 | train | Returns the job runner for this job. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | JobTask.writer | def writer(self, outputs, stdout, stderr=sys.stderr):
"""
Writer format is a method which iterates over the output records
from the reducer and formats them for output.
The default implementation outputs tab separated items.
"""
for output in outputs:
try:
... | python | def writer(self, outputs, stdout, stderr=sys.stderr):
"""
Writer format is a method which iterates over the output records
from the reducer and formats them for output.
The default implementation outputs tab separated items.
"""
for output in outputs:
try:
... | [
"def",
"writer",
"(",
"self",
",",
"outputs",
",",
"stdout",
",",
"stderr",
"=",
"sys",
".",
"stderr",
")",
":",
"for",
"output",
"in",
"outputs",
":",
"try",
":",
"output",
"=",
"flatten",
"(",
"output",
")",
"if",
"self",
".",
"data_interchange_forma... | Writer format is a method which iterates over the output records
from the reducer and formats them for output.
The default implementation outputs tab separated items. | [
"Writer",
"format",
"is",
"a",
"method",
"which",
"iterates",
"over",
"the",
"output",
"records",
"from",
"the",
"reducer",
"and",
"formats",
"them",
"for",
"output",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L839-L858 | train | This method writes the records to stdout and stderr. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | JobTask.incr_counter | def incr_counter(self, *args, **kwargs):
"""
Increments a Hadoop counter.
Since counters can be a bit slow to update, this batches the updates.
"""
threshold = kwargs.get("threshold", self.batch_counter_default)
if len(args) == 2:
# backwards compatibility wi... | python | def incr_counter(self, *args, **kwargs):
"""
Increments a Hadoop counter.
Since counters can be a bit slow to update, this batches the updates.
"""
threshold = kwargs.get("threshold", self.batch_counter_default)
if len(args) == 2:
# backwards compatibility wi... | [
"def",
"incr_counter",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"threshold",
"=",
"kwargs",
".",
"get",
"(",
"\"threshold\"",
",",
"self",
".",
"batch_counter_default",
")",
"if",
"len",
"(",
"args",
")",
"==",
"2",
":",
"# b... | Increments a Hadoop counter.
Since counters can be a bit slow to update, this batches the updates. | [
"Increments",
"a",
"Hadoop",
"counter",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L870-L891 | train | Increments a Hadoop counter. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | JobTask._flush_batch_incr_counter | def _flush_batch_incr_counter(self):
"""
Increments any unflushed counter values.
"""
for key, count in six.iteritems(self._counter_dict):
if count == 0:
continue
args = list(key) + [count]
self._incr_counter(*args)
self._co... | python | def _flush_batch_incr_counter(self):
"""
Increments any unflushed counter values.
"""
for key, count in six.iteritems(self._counter_dict):
if count == 0:
continue
args = list(key) + [count]
self._incr_counter(*args)
self._co... | [
"def",
"_flush_batch_incr_counter",
"(",
"self",
")",
":",
"for",
"key",
",",
"count",
"in",
"six",
".",
"iteritems",
"(",
"self",
".",
"_counter_dict",
")",
":",
"if",
"count",
"==",
"0",
":",
"continue",
"args",
"=",
"list",
"(",
"key",
")",
"+",
"... | Increments any unflushed counter values. | [
"Increments",
"any",
"unflushed",
"counter",
"values",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L893-L902 | train | Increments any unflushed counter values. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | JobTask._incr_counter | def _incr_counter(self, *args):
"""
Increments a Hadoop counter.
Note that this seems to be a bit slow, ~1 ms
Don't overuse this function by updating very frequently.
"""
if len(args) == 2:
# backwards compatibility with existing hadoop jobs
grou... | python | def _incr_counter(self, *args):
"""
Increments a Hadoop counter.
Note that this seems to be a bit slow, ~1 ms
Don't overuse this function by updating very frequently.
"""
if len(args) == 2:
# backwards compatibility with existing hadoop jobs
grou... | [
"def",
"_incr_counter",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"2",
":",
"# backwards compatibility with existing hadoop jobs",
"group_name",
",",
"count",
"=",
"args",
"print",
"(",
"'reporter:counter:%s,%s'",
"%",
"(",
... | Increments a Hadoop counter.
Note that this seems to be a bit slow, ~1 ms
Don't overuse this function by updating very frequently. | [
"Increments",
"a",
"Hadoop",
"counter",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L904-L918 | train | Increments a Hadoop counter. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | JobTask.dump | def dump(self, directory=''):
"""
Dump instance to file.
"""
with self.no_unpicklable_properties():
file_name = os.path.join(directory, 'job-instance.pickle')
if self.__module__ == '__main__':
d = pickle.dumps(self)
module_name = os... | python | def dump(self, directory=''):
"""
Dump instance to file.
"""
with self.no_unpicklable_properties():
file_name = os.path.join(directory, 'job-instance.pickle')
if self.__module__ == '__main__':
d = pickle.dumps(self)
module_name = os... | [
"def",
"dump",
"(",
"self",
",",
"directory",
"=",
"''",
")",
":",
"with",
"self",
".",
"no_unpicklable_properties",
"(",
")",
":",
"file_name",
"=",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"'job-instance.pickle'",
")",
"if",
"self",
".",
... | Dump instance to file. | [
"Dump",
"instance",
"to",
"file",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L974-L987 | train | Dump the instance to a file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | JobTask._map_input | def _map_input(self, input_stream):
"""
Iterate over input and call the mapper for each item.
If the job has a parser defined, the return values from the parser will
be passed as arguments to the mapper.
If the input is coded output from a previous run,
the arguments wil... | python | def _map_input(self, input_stream):
"""
Iterate over input and call the mapper for each item.
If the job has a parser defined, the return values from the parser will
be passed as arguments to the mapper.
If the input is coded output from a previous run,
the arguments wil... | [
"def",
"_map_input",
"(",
"self",
",",
"input_stream",
")",
":",
"for",
"record",
"in",
"self",
".",
"reader",
"(",
"input_stream",
")",
":",
"for",
"output",
"in",
"self",
".",
"mapper",
"(",
"*",
"record",
")",
":",
"yield",
"output",
"if",
"self",
... | Iterate over input and call the mapper for each item.
If the job has a parser defined, the return values from the parser will
be passed as arguments to the mapper.
If the input is coded output from a previous run,
the arguments will be splitted in key and value. | [
"Iterate",
"over",
"input",
"and",
"call",
"the",
"mapper",
"for",
"each",
"item",
".",
"If",
"the",
"job",
"has",
"a",
"parser",
"defined",
"the",
"return",
"values",
"from",
"the",
"parser",
"will",
"be",
"passed",
"as",
"arguments",
"to",
"the",
"mapp... | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L989-L1004 | train | Iterate over input and call the mapper for each item. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | JobTask._reduce_input | def _reduce_input(self, inputs, reducer, final=NotImplemented):
"""
Iterate over input, collect values with the same key, and call the reducer for each unique key.
"""
for key, values in groupby(inputs, key=lambda x: self.internal_serialize(x[0])):
for output in reducer(self.... | python | def _reduce_input(self, inputs, reducer, final=NotImplemented):
"""
Iterate over input, collect values with the same key, and call the reducer for each unique key.
"""
for key, values in groupby(inputs, key=lambda x: self.internal_serialize(x[0])):
for output in reducer(self.... | [
"def",
"_reduce_input",
"(",
"self",
",",
"inputs",
",",
"reducer",
",",
"final",
"=",
"NotImplemented",
")",
":",
"for",
"key",
",",
"values",
"in",
"groupby",
"(",
"inputs",
",",
"key",
"=",
"lambda",
"x",
":",
"self",
".",
"internal_serialize",
"(",
... | Iterate over input, collect values with the same key, and call the reducer for each unique key. | [
"Iterate",
"over",
"input",
"collect",
"values",
"with",
"the",
"same",
"key",
"and",
"call",
"the",
"reducer",
"for",
"each",
"unique",
"key",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1006-L1016 | train | Iterate over input and call the reducer for each unique key. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | JobTask.run_mapper | def run_mapper(self, stdin=sys.stdin, stdout=sys.stdout):
"""
Run the mapper on the hadoop node.
"""
self.init_hadoop()
self.init_mapper()
outputs = self._map_input((line[:-1] for line in stdin))
if self.reducer == NotImplemented:
self.writer(outputs, ... | python | def run_mapper(self, stdin=sys.stdin, stdout=sys.stdout):
"""
Run the mapper on the hadoop node.
"""
self.init_hadoop()
self.init_mapper()
outputs = self._map_input((line[:-1] for line in stdin))
if self.reducer == NotImplemented:
self.writer(outputs, ... | [
"def",
"run_mapper",
"(",
"self",
",",
"stdin",
"=",
"sys",
".",
"stdin",
",",
"stdout",
"=",
"sys",
".",
"stdout",
")",
":",
"self",
".",
"init_hadoop",
"(",
")",
"self",
".",
"init_mapper",
"(",
")",
"outputs",
"=",
"self",
".",
"_map_input",
"(",
... | Run the mapper on the hadoop node. | [
"Run",
"the",
"mapper",
"on",
"the",
"hadoop",
"node",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1018-L1028 | train | Run the mapper on the hadoop node. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | JobTask.run_reducer | def run_reducer(self, stdin=sys.stdin, stdout=sys.stdout):
"""
Run the reducer on the hadoop node.
"""
self.init_hadoop()
self.init_reducer()
outputs = self._reduce_input(self.internal_reader((line[:-1] for line in stdin)), self.reducer, self.final_reducer)
self.w... | python | def run_reducer(self, stdin=sys.stdin, stdout=sys.stdout):
"""
Run the reducer on the hadoop node.
"""
self.init_hadoop()
self.init_reducer()
outputs = self._reduce_input(self.internal_reader((line[:-1] for line in stdin)), self.reducer, self.final_reducer)
self.w... | [
"def",
"run_reducer",
"(",
"self",
",",
"stdin",
"=",
"sys",
".",
"stdin",
",",
"stdout",
"=",
"sys",
".",
"stdout",
")",
":",
"self",
".",
"init_hadoop",
"(",
")",
"self",
".",
"init_reducer",
"(",
")",
"outputs",
"=",
"self",
".",
"_reduce_input",
... | Run the reducer on the hadoop node. | [
"Run",
"the",
"reducer",
"on",
"the",
"hadoop",
"node",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1030-L1037 | train | Run the reducer on the hadoop node. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | JobTask.internal_reader | def internal_reader(self, input_stream):
"""
Reader which uses python eval on each part of a tab separated string.
Yields a tuple of python objects.
"""
for input_line in input_stream:
yield list(map(self.deserialize, input_line.split("\t"))) | python | def internal_reader(self, input_stream):
"""
Reader which uses python eval on each part of a tab separated string.
Yields a tuple of python objects.
"""
for input_line in input_stream:
yield list(map(self.deserialize, input_line.split("\t"))) | [
"def",
"internal_reader",
"(",
"self",
",",
"input_stream",
")",
":",
"for",
"input_line",
"in",
"input_stream",
":",
"yield",
"list",
"(",
"map",
"(",
"self",
".",
"deserialize",
",",
"input_line",
".",
"split",
"(",
"\"\\t\"",
")",
")",
")"
] | Reader which uses python eval on each part of a tab separated string.
Yields a tuple of python objects. | [
"Reader",
"which",
"uses",
"python",
"eval",
"on",
"each",
"part",
"of",
"a",
"tab",
"separated",
"string",
".",
"Yields",
"a",
"tuple",
"of",
"python",
"objects",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1045-L1051 | train | A generator which yields a tuple of python objects. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/hadoop.py | JobTask.internal_writer | def internal_writer(self, outputs, stdout):
"""
Writer which outputs the python repr for each item.
"""
for output in outputs:
print("\t".join(map(self.internal_serialize, output)), file=stdout) | python | def internal_writer(self, outputs, stdout):
"""
Writer which outputs the python repr for each item.
"""
for output in outputs:
print("\t".join(map(self.internal_serialize, output)), file=stdout) | [
"def",
"internal_writer",
"(",
"self",
",",
"outputs",
",",
"stdout",
")",
":",
"for",
"output",
"in",
"outputs",
":",
"print",
"(",
"\"\\t\"",
".",
"join",
"(",
"map",
"(",
"self",
".",
"internal_serialize",
",",
"output",
")",
")",
",",
"file",
"=",
... | Writer which outputs the python repr for each item. | [
"Writer",
"which",
"outputs",
"the",
"python",
"repr",
"for",
"each",
"item",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/hadoop.py#L1053-L1058 | train | A writer which outputs the python repr for each item. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/postgres.py | PostgresTarget.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",
":",
"# TODO: test this",
"connection",
"=",
"self",
".",
"connect",
"(",
")",
"connection",
".",
"autoco... | 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/postgres.py#L139-L166 | train | Mark this update as complete. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/postgres.py | PostgresTarget.connect | def connect(self):
"""
Get a psycopg2 connection object to the database where the table is.
"""
connection = psycopg2.connect(
host=self.host,
port=self.port,
database=self.database,
user=self.user,
password=self.password)
... | python | def connect(self):
"""
Get a psycopg2 connection object to the database where the table is.
"""
connection = psycopg2.connect(
host=self.host,
port=self.port,
database=self.database,
user=self.user,
password=self.password)
... | [
"def",
"connect",
"(",
"self",
")",
":",
"connection",
"=",
"psycopg2",
".",
"connect",
"(",
"host",
"=",
"self",
".",
"host",
",",
"port",
"=",
"self",
".",
"port",
",",
"database",
"=",
"self",
".",
"database",
",",
"user",
"=",
"self",
".",
"use... | Get a psycopg2 connection object to the database where the table is. | [
"Get",
"a",
"psycopg2",
"connection",
"object",
"to",
"the",
"database",
"where",
"the",
"table",
"is",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L187-L198 | train | Get a psycopg2 connection object to the database where the table is. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/postgres.py | PostgresTarget.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()
connection.autocommit = True
cursor = connection.cursor()
if self.use_db_... | 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()
connection.autocommit = True
cursor = connection.cursor()
if self.use_db_... | [
"def",
"create_marker_table",
"(",
"self",
")",
":",
"connection",
"=",
"self",
".",
"connect",
"(",
")",
"connection",
".",
"autocommit",
"=",
"True",
"cursor",
"=",
"connection",
".",
"cursor",
"(",
")",
"if",
"self",
".",
"use_db_timestamps",
":",
"sql"... | 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/postgres.py#L200-L229 | train | Create marker table if it doesn t exist. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/postgres.py | CopyToTable.rows | def rows(self):
"""
Return/yield tuples or lists corresponding to each row to be inserted.
"""
with self.input().open('r') as fobj:
for line in fobj:
yield line.strip('\n').split('\t') | python | def rows(self):
"""
Return/yield tuples or lists corresponding to each row to be inserted.
"""
with self.input().open('r') as fobj:
for line in fobj:
yield line.strip('\n').split('\t') | [
"def",
"rows",
"(",
"self",
")",
":",
"with",
"self",
".",
"input",
"(",
")",
".",
"open",
"(",
"'r'",
")",
"as",
"fobj",
":",
"for",
"line",
"in",
"fobj",
":",
"yield",
"line",
".",
"strip",
"(",
"'\\n'",
")",
".",
"split",
"(",
"'\\t'",
")"
] | Return/yield tuples or lists corresponding to each row to be inserted. | [
"Return",
"/",
"yield",
"tuples",
"or",
"lists",
"corresponding",
"to",
"each",
"row",
"to",
"be",
"inserted",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L247-L253 | train | Return tuples or lists corresponding to each row in the table. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/postgres.py | CopyToTable.map_column | def map_column(self, value):
"""
Applied to each column of every row returned by `rows`.
Default behaviour is to escape special characters and identify any self.null_values.
"""
if value in self.null_values:
return r'\\N'
else:
return default_esca... | python | def map_column(self, value):
"""
Applied to each column of every row returned by `rows`.
Default behaviour is to escape special characters and identify any self.null_values.
"""
if value in self.null_values:
return r'\\N'
else:
return default_esca... | [
"def",
"map_column",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"in",
"self",
".",
"null_values",
":",
"return",
"r'\\\\N'",
"else",
":",
"return",
"default_escape",
"(",
"six",
".",
"text_type",
"(",
"value",
")",
")"
] | Applied to each column of every row returned by `rows`.
Default behaviour is to escape special characters and identify any self.null_values. | [
"Applied",
"to",
"each",
"column",
"of",
"every",
"row",
"returned",
"by",
"rows",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L255-L264 | train | Map the value of a column of the table to a string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/postgres.py | CopyToTable.output | def output(self):
"""
Returns a PostgresTarget representing the inserted dataset.
Normally you don't override this.
"""
return PostgresTarget(
host=self.host,
database=self.database,
user=self.user,
password=self.password,
... | python | def output(self):
"""
Returns a PostgresTarget representing the inserted dataset.
Normally you don't override this.
"""
return PostgresTarget(
host=self.host,
database=self.database,
user=self.user,
password=self.password,
... | [
"def",
"output",
"(",
"self",
")",
":",
"return",
"PostgresTarget",
"(",
"host",
"=",
"self",
".",
"host",
",",
"database",
"=",
"self",
".",
"database",
",",
"user",
"=",
"self",
".",
"user",
",",
"password",
"=",
"self",
".",
"password",
",",
"tabl... | Returns a PostgresTarget representing the inserted dataset.
Normally you don't override this. | [
"Returns",
"a",
"PostgresTarget",
"representing",
"the",
"inserted",
"dataset",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/postgres.py#L268-L282 | train | Returns a PostgresTarget representing the inserted dataset. Normally you don t override this. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/postgres.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/postgres.py#L293-L349 | train | Runs the main entry point for the SQL database. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/configuration/core.py | get_config | def get_config(parser=PARSER):
"""Get configs singleton for parser
"""
parser_class = PARSERS[parser]
_check_parser(parser_class, parser)
return parser_class.instance() | python | def get_config(parser=PARSER):
"""Get configs singleton for parser
"""
parser_class = PARSERS[parser]
_check_parser(parser_class, parser)
return parser_class.instance() | [
"def",
"get_config",
"(",
"parser",
"=",
"PARSER",
")",
":",
"parser_class",
"=",
"PARSERS",
"[",
"parser",
"]",
"_check_parser",
"(",
"parser_class",
",",
"parser",
")",
"return",
"parser_class",
".",
"instance",
"(",
")"
] | Get configs singleton for parser | [
"Get",
"configs",
"singleton",
"for",
"parser"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/configuration/core.py#L53-L58 | train | Get configs singleton for parser | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/configuration/core.py | add_config_path | def add_config_path(path):
"""Select config parser by file extension and add path into parser.
"""
if not os.path.isfile(path):
warnings.warn("Config file does not exist: {path}".format(path=path))
return False
# select parser by file extension
_base, ext = os.path.splitext(path)
... | python | def add_config_path(path):
"""Select config parser by file extension and add path into parser.
"""
if not os.path.isfile(path):
warnings.warn("Config file does not exist: {path}".format(path=path))
return False
# select parser by file extension
_base, ext = os.path.splitext(path)
... | [
"def",
"add_config_path",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"warnings",
".",
"warn",
"(",
"\"Config file does not exist: {path}\"",
".",
"format",
"(",
"path",
"=",
"path",
")",
")",
"return",
"F... | Select config parser by file extension and add path into parser. | [
"Select",
"config",
"parser",
"by",
"file",
"extension",
"and",
"add",
"path",
"into",
"parser",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/configuration/core.py#L61-L87 | train | Add config path into parser. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/spark.py | PySparkTask._setup_packages | def _setup_packages(self, sc):
"""
This method compresses and uploads packages to the cluster
"""
packages = self.py_packages
if not packages:
return
for package in packages:
mod = importlib.import_module(package)
try:
... | python | def _setup_packages(self, sc):
"""
This method compresses and uploads packages to the cluster
"""
packages = self.py_packages
if not packages:
return
for package in packages:
mod = importlib.import_module(package)
try:
... | [
"def",
"_setup_packages",
"(",
"self",
",",
"sc",
")",
":",
"packages",
"=",
"self",
".",
"py_packages",
"if",
"not",
"packages",
":",
"return",
"for",
"package",
"in",
"packages",
":",
"mod",
"=",
"importlib",
".",
"import_module",
"(",
"package",
")",
... | This method compresses and uploads packages to the cluster | [
"This",
"method",
"compresses",
"and",
"uploads",
"packages",
"to",
"the",
"cluster"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/spark.py#L323-L341 | train | This method compresses and uploads packages to the cluster | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/contrib/mrrunner.py | main | def main(args=None, stdin=sys.stdin, stdout=sys.stdout, print_exception=print_exception):
"""
Run either the mapper, combiner, or reducer from the class instance in the file "job-instance.pickle".
Arguments:
kind -- is either map, combiner, or reduce
"""
try:
# Set up logging.
... | python | def main(args=None, stdin=sys.stdin, stdout=sys.stdout, print_exception=print_exception):
"""
Run either the mapper, combiner, or reducer from the class instance in the file "job-instance.pickle".
Arguments:
kind -- is either map, combiner, or reduce
"""
try:
# Set up logging.
... | [
"def",
"main",
"(",
"args",
"=",
"None",
",",
"stdin",
"=",
"sys",
".",
"stdin",
",",
"stdout",
"=",
"sys",
".",
"stdout",
",",
"print_exception",
"=",
"print_exception",
")",
":",
"try",
":",
"# Set up logging.",
"logging",
".",
"basicConfig",
"(",
"lev... | Run either the mapper, combiner, or reducer from the class instance in the file "job-instance.pickle".
Arguments:
kind -- is either map, combiner, or reduce | [
"Run",
"either",
"the",
"mapper",
"combiner",
"or",
"reducer",
"from",
"the",
"class",
"instance",
"in",
"the",
"file",
"job",
"-",
"instance",
".",
"pickle",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/contrib/mrrunner.py#L80-L97 | train | Main function for the job - instance. py script. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/retcodes.py | run_with_retcodes | def run_with_retcodes(argv):
"""
Run luigi with command line parsing, but raise ``SystemExit`` with the configured exit code.
Note: Usually you use the luigi binary directly and don't call this function yourself.
:param argv: Should (conceptually) be ``sys.argv[1:]``
"""
logger = logging.getLo... | python | def run_with_retcodes(argv):
"""
Run luigi with command line parsing, but raise ``SystemExit`` with the configured exit code.
Note: Usually you use the luigi binary directly and don't call this function yourself.
:param argv: Should (conceptually) be ``sys.argv[1:]``
"""
logger = logging.getLo... | [
"def",
"run_with_retcodes",
"(",
"argv",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"'luigi-interface'",
")",
"with",
"luigi",
".",
"cmdline_parser",
".",
"CmdlineParser",
".",
"global_instance",
"(",
"argv",
")",
":",
"retcodes",
"=",
"retcode... | Run luigi with command line parsing, but raise ``SystemExit`` with the configured exit code.
Note: Usually you use the luigi binary directly and don't call this function yourself.
:param argv: Should (conceptually) be ``sys.argv[1:]`` | [
"Run",
"luigi",
"with",
"command",
"line",
"parsing",
"but",
"raise",
"SystemExit",
"with",
"the",
"configured",
"exit",
"code",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/retcodes.py#L61-L108 | train | Run luigi with command line parsing but raise SystemExit with the configured exit code. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/deps.py | find_deps_cli | def find_deps_cli():
'''
Finds all tasks on all paths from provided CLI task
'''
cmdline_args = sys.argv[1:]
with CmdlineParser.global_instance(cmdline_args) as cp:
return find_deps(cp.get_task_obj(), upstream().family) | python | def find_deps_cli():
'''
Finds all tasks on all paths from provided CLI task
'''
cmdline_args = sys.argv[1:]
with CmdlineParser.global_instance(cmdline_args) as cp:
return find_deps(cp.get_task_obj(), upstream().family) | [
"def",
"find_deps_cli",
"(",
")",
":",
"cmdline_args",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"with",
"CmdlineParser",
".",
"global_instance",
"(",
"cmdline_args",
")",
"as",
"cp",
":",
"return",
"find_deps",
"(",
"cp",
".",
"get_task_obj",
"(",
")... | Finds all tasks on all paths from provided CLI task | [
"Finds",
"all",
"tasks",
"on",
"all",
"paths",
"from",
"provided",
"CLI",
"task"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/deps.py#L85-L91 | train | Find all tasks on all paths from provided CLI task
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/deps.py | get_task_output_description | def get_task_output_description(task_output):
'''
Returns a task's output as a string
'''
output_description = "n/a"
if isinstance(task_output, RemoteTarget):
output_description = "[SSH] {0}:{1}".format(task_output._fs.remote_context.host, task_output.path)
elif isinstance(task_output, ... | python | def get_task_output_description(task_output):
'''
Returns a task's output as a string
'''
output_description = "n/a"
if isinstance(task_output, RemoteTarget):
output_description = "[SSH] {0}:{1}".format(task_output._fs.remote_context.host, task_output.path)
elif isinstance(task_output, ... | [
"def",
"get_task_output_description",
"(",
"task_output",
")",
":",
"output_description",
"=",
"\"n/a\"",
"if",
"isinstance",
"(",
"task_output",
",",
"RemoteTarget",
")",
":",
"output_description",
"=",
"\"[SSH] {0}:{1}\"",
".",
"format",
"(",
"task_output",
".",
"... | Returns a task's output as a string | [
"Returns",
"a",
"task",
"s",
"output",
"as",
"a",
"string"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/deps.py#L94-L111 | train | Returns a task s output as a string
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/range.py | _constrain_glob | def _constrain_glob(glob, paths, limit=5):
"""
Tweaks glob into a list of more specific globs that together still cover paths and not too much extra.
Saves us minutes long listings for long dataset histories.
Specifically, in this implementation the leftmost occurrences of "[0-9]"
give rise to a f... | python | def _constrain_glob(glob, paths, limit=5):
"""
Tweaks glob into a list of more specific globs that together still cover paths and not too much extra.
Saves us minutes long listings for long dataset histories.
Specifically, in this implementation the leftmost occurrences of "[0-9]"
give rise to a f... | [
"def",
"_constrain_glob",
"(",
"glob",
",",
"paths",
",",
"limit",
"=",
"5",
")",
":",
"def",
"digit_set_wildcard",
"(",
"chars",
")",
":",
"\"\"\"\n Makes a wildcard expression for the set, a bit readable, e.g. [1-5].\n \"\"\"",
"chars",
"=",
"sorted",
"(",... | Tweaks glob into a list of more specific globs that together still cover paths and not too much extra.
Saves us minutes long listings for long dataset histories.
Specifically, in this implementation the leftmost occurrences of "[0-9]"
give rise to a few separate globs that each specialize the expression t... | [
"Tweaks",
"glob",
"into",
"a",
"list",
"of",
"more",
"specific",
"globs",
"that",
"together",
"still",
"cover",
"paths",
"and",
"not",
"too",
"much",
"extra",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L491-L528 | train | Constrain globs to a list of more specific globs that cover paths and not too much extra. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/range.py | most_common | def most_common(items):
"""
Wanted functionality from Counters (new in Python 2.7).
"""
counts = {}
for i in items:
counts.setdefault(i, 0)
counts[i] += 1
return max(six.iteritems(counts), key=operator.itemgetter(1)) | python | def most_common(items):
"""
Wanted functionality from Counters (new in Python 2.7).
"""
counts = {}
for i in items:
counts.setdefault(i, 0)
counts[i] += 1
return max(six.iteritems(counts), key=operator.itemgetter(1)) | [
"def",
"most_common",
"(",
"items",
")",
":",
"counts",
"=",
"{",
"}",
"for",
"i",
"in",
"items",
":",
"counts",
".",
"setdefault",
"(",
"i",
",",
"0",
")",
"counts",
"[",
"i",
"]",
"+=",
"1",
"return",
"max",
"(",
"six",
".",
"iteritems",
"(",
... | Wanted functionality from Counters (new in Python 2.7). | [
"Wanted",
"functionality",
"from",
"Counters",
"(",
"new",
"in",
"Python",
"2",
".",
"7",
")",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L531-L539 | train | Returns the most common item in the list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/range.py | _get_per_location_glob | def _get_per_location_glob(tasks, outputs, regexes):
"""
Builds a glob listing existing output paths.
Esoteric reverse engineering, but worth it given that (compared to an
equivalent contiguousness guarantee by naive complete() checks)
requests to the filesystem are cut by orders of magnitude, and ... | python | def _get_per_location_glob(tasks, outputs, regexes):
"""
Builds a glob listing existing output paths.
Esoteric reverse engineering, but worth it given that (compared to an
equivalent contiguousness guarantee by naive complete() checks)
requests to the filesystem are cut by orders of magnitude, and ... | [
"def",
"_get_per_location_glob",
"(",
"tasks",
",",
"outputs",
",",
"regexes",
")",
":",
"paths",
"=",
"[",
"o",
".",
"path",
"for",
"o",
"in",
"outputs",
"]",
"# naive, because some matches could be confused by numbers earlier",
"# in path, e.g. /foo/fifa2000k/bar/2000-1... | Builds a glob listing existing output paths.
Esoteric reverse engineering, but worth it given that (compared to an
equivalent contiguousness guarantee by naive complete() checks)
requests to the filesystem are cut by orders of magnitude, and users
don't even have to retrofit existing tasks anyhow. | [
"Builds",
"a",
"glob",
"listing",
"existing",
"output",
"paths",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L542-L570 | train | Builds a glob listing existing output paths. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/range.py | _get_filesystems_and_globs | def _get_filesystems_and_globs(datetime_to_task, datetime_to_re):
"""
Yields a (filesystem, glob) tuple per every output location of task.
The task can have one or several FileSystemTarget outputs.
For convenience, the task can be a luigi.WrapperTask,
in which case outputs of all its dependencies ... | python | def _get_filesystems_and_globs(datetime_to_task, datetime_to_re):
"""
Yields a (filesystem, glob) tuple per every output location of task.
The task can have one or several FileSystemTarget outputs.
For convenience, the task can be a luigi.WrapperTask,
in which case outputs of all its dependencies ... | [
"def",
"_get_filesystems_and_globs",
"(",
"datetime_to_task",
",",
"datetime_to_re",
")",
":",
"# probe some scattered datetimes unlikely to all occur in paths, other than by being sincere datetime parameter's representations",
"# TODO limit to [self.start, self.stop) so messages are less confusin... | Yields a (filesystem, glob) tuple per every output location of task.
The task can have one or several FileSystemTarget outputs.
For convenience, the task can be a luigi.WrapperTask,
in which case outputs of all its dependencies are considered. | [
"Yields",
"a",
"(",
"filesystem",
"glob",
")",
"tuple",
"per",
"every",
"output",
"location",
"of",
"task",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L573-L600 | train | Yields a set of filesystems and globs per every output location of a task. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/range.py | _list_existing | def _list_existing(filesystem, glob, paths):
"""
Get all the paths that do in fact exist. Returns a set of all existing paths.
Takes a luigi.target.FileSystem object, a str which represents a glob and
a list of strings representing paths.
"""
globs = _constrain_glob(glob, paths)
time_start ... | python | def _list_existing(filesystem, glob, paths):
"""
Get all the paths that do in fact exist. Returns a set of all existing paths.
Takes a luigi.target.FileSystem object, a str which represents a glob and
a list of strings representing paths.
"""
globs = _constrain_glob(glob, paths)
time_start ... | [
"def",
"_list_existing",
"(",
"filesystem",
",",
"glob",
",",
"paths",
")",
":",
"globs",
"=",
"_constrain_glob",
"(",
"glob",
",",
"paths",
")",
"time_start",
"=",
"time",
".",
"time",
"(",
")",
"listing",
"=",
"[",
"]",
"for",
"g",
"in",
"sorted",
... | Get all the paths that do in fact exist. Returns a set of all existing paths.
Takes a luigi.target.FileSystem object, a str which represents a glob and
a list of strings representing paths. | [
"Get",
"all",
"the",
"paths",
"that",
"do",
"in",
"fact",
"exist",
".",
"Returns",
"a",
"set",
"of",
"all",
"existing",
"paths",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L603-L619 | train | List all the paths that do in fact exist. Returns a set of all the paths that do in fact exist. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/range.py | infer_bulk_complete_from_fs | def infer_bulk_complete_from_fs(datetimes, datetime_to_task, datetime_to_re):
"""
Efficiently determines missing datetimes by filesystem listing.
The current implementation works for the common case of a task writing
output to a ``FileSystemTarget`` whose path is built using strftime with
format li... | python | def infer_bulk_complete_from_fs(datetimes, datetime_to_task, datetime_to_re):
"""
Efficiently determines missing datetimes by filesystem listing.
The current implementation works for the common case of a task writing
output to a ``FileSystemTarget`` whose path is built using strftime with
format li... | [
"def",
"infer_bulk_complete_from_fs",
"(",
"datetimes",
",",
"datetime_to_task",
",",
"datetime_to_re",
")",
":",
"filesystems_and_globs_by_location",
"=",
"_get_filesystems_and_globs",
"(",
"datetime_to_task",
",",
"datetime_to_re",
")",
"paths_by_datetime",
"=",
"[",
"[",... | Efficiently determines missing datetimes by filesystem listing.
The current implementation works for the common case of a task writing
output to a ``FileSystemTarget`` whose path is built using strftime with
format like '...%Y...%m...%d...%H...', without custom ``complete()`` or
``exists()``.
(Eve... | [
"Efficiently",
"determines",
"missing",
"datetimes",
"by",
"filesystem",
"listing",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L622-L647 | train | Infer bulk completion from a list of datetimes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/range.py | RangeBase.of_cls | def of_cls(self):
"""
DONT USE. Will be deleted soon. Use ``self.of``!
"""
if isinstance(self.of, six.string_types):
warnings.warn('When using Range programatically, dont pass "of" param as string!')
return Register.get_task_cls(self.of)
return self.of | python | def of_cls(self):
"""
DONT USE. Will be deleted soon. Use ``self.of``!
"""
if isinstance(self.of, six.string_types):
warnings.warn('When using Range programatically, dont pass "of" param as string!')
return Register.get_task_cls(self.of)
return self.of | [
"def",
"of_cls",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"of",
",",
"six",
".",
"string_types",
")",
":",
"warnings",
".",
"warn",
"(",
"'When using Range programatically, dont pass \"of\" param as string!'",
")",
"return",
"Register",
".",
... | DONT USE. Will be deleted soon. Use ``self.of``! | [
"DONT",
"USE",
".",
"Will",
"be",
"deleted",
"soon",
".",
"Use",
"self",
".",
"of",
"!"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L117-L124 | train | Returns the class name of the current instance. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/range.py | RangeBase._emit_metrics | def _emit_metrics(self, missing_datetimes, finite_start, finite_stop):
"""
For consistent metrics one should consider the entire range, but
it is open (infinite) if stop or start is None.
Hence make do with metrics respective to the finite simplification.
"""
datetimes =... | python | def _emit_metrics(self, missing_datetimes, finite_start, finite_stop):
"""
For consistent metrics one should consider the entire range, but
it is open (infinite) if stop or start is None.
Hence make do with metrics respective to the finite simplification.
"""
datetimes =... | [
"def",
"_emit_metrics",
"(",
"self",
",",
"missing_datetimes",
",",
"finite_start",
",",
"finite_stop",
")",
":",
"datetimes",
"=",
"self",
".",
"finite_datetimes",
"(",
"finite_start",
"if",
"self",
".",
"start",
"is",
"None",
"else",
"min",
"(",
"finite_star... | For consistent metrics one should consider the entire range, but
it is open (infinite) if stop or start is None.
Hence make do with metrics respective to the finite simplification. | [
"For",
"consistent",
"metrics",
"one",
"should",
"consider",
"the",
"entire",
"range",
"but",
"it",
"is",
"open",
"(",
"infinite",
")",
"if",
"stop",
"or",
"start",
"is",
"None",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L166-L183 | train | Emit the range events. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/range.py | RangeBase.missing_datetimes | def missing_datetimes(self, finite_datetimes):
"""
Override in subclasses to do bulk checks.
Returns a sorted list.
This is a conservative base implementation that brutally checks completeness, instance by instance.
Inadvisable as it may be slow.
"""
return [d ... | python | def missing_datetimes(self, finite_datetimes):
"""
Override in subclasses to do bulk checks.
Returns a sorted list.
This is a conservative base implementation that brutally checks completeness, instance by instance.
Inadvisable as it may be slow.
"""
return [d ... | [
"def",
"missing_datetimes",
"(",
"self",
",",
"finite_datetimes",
")",
":",
"return",
"[",
"d",
"for",
"d",
"in",
"finite_datetimes",
"if",
"not",
"self",
".",
"_instantiate_task_cls",
"(",
"self",
".",
"datetime_to_parameter",
"(",
"d",
")",
")",
".",
"comp... | Override in subclasses to do bulk checks.
Returns a sorted list.
This is a conservative base implementation that brutally checks completeness, instance by instance.
Inadvisable as it may be slow. | [
"Override",
"in",
"subclasses",
"to",
"do",
"bulk",
"checks",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L255-L265 | train | Returns a list of missing datetimes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/range.py | RangeBase._missing_datetimes | def _missing_datetimes(self, finite_datetimes):
"""
Backward compatible wrapper. Will be deleted eventually (stated on Dec 2015)
"""
try:
return self.missing_datetimes(finite_datetimes)
except TypeError as ex:
if 'missing_datetimes()' in repr(ex):
... | python | def _missing_datetimes(self, finite_datetimes):
"""
Backward compatible wrapper. Will be deleted eventually (stated on Dec 2015)
"""
try:
return self.missing_datetimes(finite_datetimes)
except TypeError as ex:
if 'missing_datetimes()' in repr(ex):
... | [
"def",
"_missing_datetimes",
"(",
"self",
",",
"finite_datetimes",
")",
":",
"try",
":",
"return",
"self",
".",
"missing_datetimes",
"(",
"finite_datetimes",
")",
"except",
"TypeError",
"as",
"ex",
":",
"if",
"'missing_datetimes()'",
"in",
"repr",
"(",
"ex",
"... | Backward compatible wrapper. Will be deleted eventually (stated on Dec 2015) | [
"Backward",
"compatible",
"wrapper",
".",
"Will",
"be",
"deleted",
"eventually",
"(",
"stated",
"on",
"Dec",
"2015",
")"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L267-L278 | train | Wrapper for missing_datetimes that returns a list of missing_datetimes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/range.py | RangeDailyBase.parameters_to_datetime | def parameters_to_datetime(self, p):
"""
Given a dictionary of parameters, will extract the ranged task parameter value
"""
dt = p[self._param_name]
return datetime(dt.year, dt.month, dt.day) | python | def parameters_to_datetime(self, p):
"""
Given a dictionary of parameters, will extract the ranged task parameter value
"""
dt = p[self._param_name]
return datetime(dt.year, dt.month, dt.day) | [
"def",
"parameters_to_datetime",
"(",
"self",
",",
"p",
")",
":",
"dt",
"=",
"p",
"[",
"self",
".",
"_param_name",
"]",
"return",
"datetime",
"(",
"dt",
".",
"year",
",",
"dt",
".",
"month",
",",
"dt",
".",
"day",
")"
] | Given a dictionary of parameters, will extract the ranged task parameter value | [
"Given",
"a",
"dictionary",
"of",
"parameters",
"will",
"extract",
"the",
"ranged",
"task",
"parameter",
"value"
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L316-L321 | train | Given a dictionary of parameters will extract the ranged task parameter value | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/range.py | RangeDailyBase.finite_datetimes | def finite_datetimes(self, finite_start, finite_stop):
"""
Simply returns the points in time that correspond to turn of day.
"""
date_start = datetime(finite_start.year, finite_start.month, finite_start.day)
dates = []
for i in itertools.count():
t = date_star... | python | def finite_datetimes(self, finite_start, finite_stop):
"""
Simply returns the points in time that correspond to turn of day.
"""
date_start = datetime(finite_start.year, finite_start.month, finite_start.day)
dates = []
for i in itertools.count():
t = date_star... | [
"def",
"finite_datetimes",
"(",
"self",
",",
"finite_start",
",",
"finite_stop",
")",
":",
"date_start",
"=",
"datetime",
"(",
"finite_start",
".",
"year",
",",
"finite_start",
".",
"month",
",",
"finite_start",
".",
"day",
")",
"dates",
"=",
"[",
"]",
"fo... | Simply returns the points in time that correspond to turn of day. | [
"Simply",
"returns",
"the",
"points",
"in",
"time",
"that",
"correspond",
"to",
"turn",
"of",
"day",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L329-L340 | train | Simply returns the points in time that correspond to turn of day. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
spotify/luigi | luigi/tools/range.py | RangeHourlyBase.finite_datetimes | def finite_datetimes(self, finite_start, finite_stop):
"""
Simply returns the points in time that correspond to whole hours.
"""
datehour_start = datetime(finite_start.year, finite_start.month, finite_start.day, finite_start.hour)
datehours = []
for i in itertools.count()... | python | def finite_datetimes(self, finite_start, finite_stop):
"""
Simply returns the points in time that correspond to whole hours.
"""
datehour_start = datetime(finite_start.year, finite_start.month, finite_start.day, finite_start.hour)
datehours = []
for i in itertools.count()... | [
"def",
"finite_datetimes",
"(",
"self",
",",
"finite_start",
",",
"finite_stop",
")",
":",
"datehour_start",
"=",
"datetime",
"(",
"finite_start",
".",
"year",
",",
"finite_start",
".",
"month",
",",
"finite_start",
".",
"day",
",",
"finite_start",
".",
"hour"... | Simply returns the points in time that correspond to whole hours. | [
"Simply",
"returns",
"the",
"points",
"in",
"time",
"that",
"correspond",
"to",
"whole",
"hours",
"."
] | c5eca1c3c3ee2a7eb612486192a0da146710a1e9 | https://github.com/spotify/luigi/blob/c5eca1c3c3ee2a7eb612486192a0da146710a1e9/luigi/tools/range.py#L391-L402 | train | Simply returns the points in time that correspond to whole hours. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Simply returns the points in time that correspond to a whole number of minutes intervals. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Simply returns the points in time that correspond to turn of month. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Mark this update as complete. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Create a SQL Server connection and return a connection object | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Create marker table if it doesn t exist. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Retrieve an opener for the given protocol name | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Adds an opener to the registry | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Open target uri. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Converts the query string from a target uri uses
cls. allowed_kwargs and cls. filter_kwargs to drive logic. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Override this method to use values from the parsed uri to initialize
Taxonomy the expected target. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Schedules a list of tasks and runs them. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Run luigi command line using argparse. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Runs the given tasks in luigi. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Mark this update as complete. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Create marker table if it doesn t exist. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Runs the main loop of the main loop. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Coerce input arguments to use temporary files when used for output. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Get name of first active job queue | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Retrieve the first job ID matching the given name | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
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 | Retrieve task statuses from ECS API
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.