partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | GCPSpeechToTextHook.get_conn | Retrieves connection to Cloud Speech.
:return: Google Cloud Speech client object.
:rtype: google.cloud.speech_v1.SpeechClient | airflow/contrib/hooks/gcp_speech_to_text_hook.py | def get_conn(self):
"""
Retrieves connection to Cloud Speech.
:return: Google Cloud Speech client object.
:rtype: google.cloud.speech_v1.SpeechClient
"""
if not self._client:
self._client = SpeechClient(credentials=self._get_credentials())
return self... | def get_conn(self):
"""
Retrieves connection to Cloud Speech.
:return: Google Cloud Speech client object.
:rtype: google.cloud.speech_v1.SpeechClient
"""
if not self._client:
self._client = SpeechClient(credentials=self._get_credentials())
return self... | [
"Retrieves",
"connection",
"to",
"Cloud",
"Speech",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_speech_to_text_hook.py#L42-L51 | [
"def",
"get_conn",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_client",
":",
"self",
".",
"_client",
"=",
"SpeechClient",
"(",
"credentials",
"=",
"self",
".",
"_get_credentials",
"(",
")",
")",
"return",
"self",
".",
"_client"
] | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | GCPSpeechToTextHook.recognize_speech | Recognizes audio input
:param config: information to the recognizer that specifies how to process the request.
https://googleapis.github.io/google-cloud-python/latest/speech/gapic/v1/types.html#google.cloud.speech_v1.types.RecognitionConfig
:type config: dict or google.cloud.speech_v1.types... | airflow/contrib/hooks/gcp_speech_to_text_hook.py | def recognize_speech(self, config, audio, retry=None, timeout=None):
"""
Recognizes audio input
:param config: information to the recognizer that specifies how to process the request.
https://googleapis.github.io/google-cloud-python/latest/speech/gapic/v1/types.html#google.cloud.spe... | def recognize_speech(self, config, audio, retry=None, timeout=None):
"""
Recognizes audio input
:param config: information to the recognizer that specifies how to process the request.
https://googleapis.github.io/google-cloud-python/latest/speech/gapic/v1/types.html#google.cloud.spe... | [
"Recognizes",
"audio",
"input"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcp_speech_to_text_hook.py#L53-L73 | [
"def",
"recognize_speech",
"(",
"self",
",",
"config",
",",
"audio",
",",
"retry",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"client",
"=",
"self",
".",
"get_conn",
"(",
")",
"response",
"=",
"client",
".",
"recognize",
"(",
"config",
"=",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | SparkSqlOperator.execute | Call the SparkSqlHook to run the provided sql query | airflow/contrib/operators/spark_sql_operator.py | def execute(self, context):
"""
Call the SparkSqlHook to run the provided sql query
"""
self._hook = SparkSqlHook(sql=self._sql,
conf=self._conf,
conn_id=self._conn_id,
total_executor_co... | def execute(self, context):
"""
Call the SparkSqlHook to run the provided sql query
"""
self._hook = SparkSqlHook(sql=self._sql,
conf=self._conf,
conn_id=self._conn_id,
total_executor_co... | [
"Call",
"the",
"SparkSqlHook",
"to",
"run",
"the",
"provided",
"sql",
"query"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/spark_sql_operator.py#L91-L108 | [
"def",
"execute",
"(",
"self",
",",
"context",
")",
":",
"self",
".",
"_hook",
"=",
"SparkSqlHook",
"(",
"sql",
"=",
"self",
".",
"_sql",
",",
"conf",
"=",
"self",
".",
"_conf",
",",
"conn_id",
"=",
"self",
".",
"_conn_id",
",",
"total_executor_cores",... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | FileTaskHandler.set_context | Provide task_instance context to airflow task handler.
:param ti: task instance object | airflow/utils/log/file_task_handler.py | def set_context(self, ti):
"""
Provide task_instance context to airflow task handler.
:param ti: task instance object
"""
local_loc = self._init_file(ti)
self.handler = logging.FileHandler(local_loc)
self.handler.setFormatter(self.formatter)
self.handler.s... | def set_context(self, ti):
"""
Provide task_instance context to airflow task handler.
:param ti: task instance object
"""
local_loc = self._init_file(ti)
self.handler = logging.FileHandler(local_loc)
self.handler.setFormatter(self.formatter)
self.handler.s... | [
"Provide",
"task_instance",
"context",
"to",
"airflow",
"task",
"handler",
".",
":",
"param",
"ti",
":",
"task",
"instance",
"object"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/log/file_task_handler.py#L49-L57 | [
"def",
"set_context",
"(",
"self",
",",
"ti",
")",
":",
"local_loc",
"=",
"self",
".",
"_init_file",
"(",
"ti",
")",
"self",
".",
"handler",
"=",
"logging",
".",
"FileHandler",
"(",
"local_loc",
")",
"self",
".",
"handler",
".",
"setFormatter",
"(",
"s... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | FileTaskHandler._read | Template method that contains custom logic of reading
logs given the try_number.
:param ti: task instance record
:param try_number: current try_number to read log from
:param metadata: log metadata,
can be used for steaming log reading and auto-tailing.
:... | airflow/utils/log/file_task_handler.py | def _read(self, ti, try_number, metadata=None):
"""
Template method that contains custom logic of reading
logs given the try_number.
:param ti: task instance record
:param try_number: current try_number to read log from
:param metadata: log metadata,
... | def _read(self, ti, try_number, metadata=None):
"""
Template method that contains custom logic of reading
logs given the try_number.
:param ti: task instance record
:param try_number: current try_number to read log from
:param metadata: log metadata,
... | [
"Template",
"method",
"that",
"contains",
"custom",
"logic",
"of",
"reading",
"logs",
"given",
"the",
"try_number",
".",
":",
"param",
"ti",
":",
"task",
"instance",
"record",
":",
"param",
"try_number",
":",
"current",
"try_number",
"to",
"read",
"log",
"fr... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/log/file_task_handler.py#L82-L133 | [
"def",
"_read",
"(",
"self",
",",
"ti",
",",
"try_number",
",",
"metadata",
"=",
"None",
")",
":",
"# Task instance here might be different from task instance when",
"# initializing the handler. Thus explicitly getting log location",
"# is needed to get correct log path.",
"log_rel... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | FileTaskHandler.read | Read logs of given task instance from local machine.
:param task_instance: task instance object
:param try_number: task instance try_number to read logs from. If None
it returns all logs separated by try_number
:param metadata: log metadata,
ca... | airflow/utils/log/file_task_handler.py | def read(self, task_instance, try_number=None, metadata=None):
"""
Read logs of given task instance from local machine.
:param task_instance: task instance object
:param try_number: task instance try_number to read logs from. If None
it returns all logs separat... | def read(self, task_instance, try_number=None, metadata=None):
"""
Read logs of given task instance from local machine.
:param task_instance: task instance object
:param try_number: task instance try_number to read logs from. If None
it returns all logs separat... | [
"Read",
"logs",
"of",
"given",
"task",
"instance",
"from",
"local",
"machine",
".",
":",
"param",
"task_instance",
":",
"task",
"instance",
"object",
":",
"param",
"try_number",
":",
"task",
"instance",
"try_number",
"to",
"read",
"logs",
"from",
".",
"If",
... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/log/file_task_handler.py#L135-L168 | [
"def",
"read",
"(",
"self",
",",
"task_instance",
",",
"try_number",
"=",
"None",
",",
"metadata",
"=",
"None",
")",
":",
"# Task instance increments its try number when it starts to run.",
"# So the log for a particular task try will only show up when",
"# try number gets increm... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | FileTaskHandler._init_file | Create log directory and give it correct permissions.
:param ti: task instance object
:return: relative log path of the given task instance | airflow/utils/log/file_task_handler.py | def _init_file(self, ti):
"""
Create log directory and give it correct permissions.
:param ti: task instance object
:return: relative log path of the given task instance
"""
# To handle log writing when tasks are impersonated, the log files need to
# be writable b... | def _init_file(self, ti):
"""
Create log directory and give it correct permissions.
:param ti: task instance object
:return: relative log path of the given task instance
"""
# To handle log writing when tasks are impersonated, the log files need to
# be writable b... | [
"Create",
"log",
"directory",
"and",
"give",
"it",
"correct",
"permissions",
".",
":",
"param",
"ti",
":",
"task",
"instance",
"object",
":",
"return",
":",
"relative",
"log",
"path",
"of",
"the",
"given",
"task",
"instance"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/log/file_task_handler.py#L170-L207 | [
"def",
"_init_file",
"(",
"self",
",",
"ti",
")",
":",
"# To handle log writing when tasks are impersonated, the log files need to",
"# be writable by the user that runs the Airflow command and the user",
"# that is impersonated. This is mainly to handle corner cases with the",
"# SubDagOperat... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | load_entrypoint_plugins | Load AirflowPlugin subclasses from the entrypoints
provided. The entry_point group should be 'airflow.plugins'.
:param entry_points: A collection of entrypoints to search for plugins
:type entry_points: Generator[setuptools.EntryPoint, None, None]
:param airflow_plugins: A collection of existing airflo... | airflow/plugins_manager.py | def load_entrypoint_plugins(entry_points, airflow_plugins):
"""
Load AirflowPlugin subclasses from the entrypoints
provided. The entry_point group should be 'airflow.plugins'.
:param entry_points: A collection of entrypoints to search for plugins
:type entry_points: Generator[setuptools.EntryPoint,... | def load_entrypoint_plugins(entry_points, airflow_plugins):
"""
Load AirflowPlugin subclasses from the entrypoints
provided. The entry_point group should be 'airflow.plugins'.
:param entry_points: A collection of entrypoints to search for plugins
:type entry_points: Generator[setuptools.EntryPoint,... | [
"Load",
"AirflowPlugin",
"subclasses",
"from",
"the",
"entrypoints",
"provided",
".",
"The",
"entry_point",
"group",
"should",
"be",
"airflow",
".",
"plugins",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/plugins_manager.py#L79-L98 | [
"def",
"load_entrypoint_plugins",
"(",
"entry_points",
",",
"airflow_plugins",
")",
":",
"for",
"entry_point",
"in",
"entry_points",
":",
"log",
".",
"debug",
"(",
"'Importing entry_point plugin %s'",
",",
"entry_point",
".",
"name",
")",
"plugin_obj",
"=",
"entry_p... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | is_valid_plugin | Check whether a potential object is a subclass of
the AirflowPlugin class.
:param plugin_obj: potential subclass of AirflowPlugin
:param existing_plugins: Existing list of AirflowPlugin subclasses
:return: Whether or not the obj is a valid subclass of
AirflowPlugin | airflow/plugins_manager.py | def is_valid_plugin(plugin_obj, existing_plugins):
"""
Check whether a potential object is a subclass of
the AirflowPlugin class.
:param plugin_obj: potential subclass of AirflowPlugin
:param existing_plugins: Existing list of AirflowPlugin subclasses
:return: Whether or not the obj is a valid ... | def is_valid_plugin(plugin_obj, existing_plugins):
"""
Check whether a potential object is a subclass of
the AirflowPlugin class.
:param plugin_obj: potential subclass of AirflowPlugin
:param existing_plugins: Existing list of AirflowPlugin subclasses
:return: Whether or not the obj is a valid ... | [
"Check",
"whether",
"a",
"potential",
"object",
"is",
"a",
"subclass",
"of",
"the",
"AirflowPlugin",
"class",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/plugins_manager.py#L101-L118 | [
"def",
"is_valid_plugin",
"(",
"plugin_obj",
",",
"existing_plugins",
")",
":",
"if",
"(",
"inspect",
".",
"isclass",
"(",
"plugin_obj",
")",
"and",
"issubclass",
"(",
"plugin_obj",
",",
"AirflowPlugin",
")",
"and",
"(",
"plugin_obj",
"is",
"not",
"AirflowPlug... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | SkipMixin.skip | Sets tasks instances to skipped from the same dag run.
:param dag_run: the DagRun for which to set the tasks to skipped
:param execution_date: execution_date
:param tasks: tasks to skip (not task_ids)
:param session: db session to use | airflow/models/skipmixin.py | def skip(self, dag_run, execution_date, tasks, session=None):
"""
Sets tasks instances to skipped from the same dag run.
:param dag_run: the DagRun for which to set the tasks to skipped
:param execution_date: execution_date
:param tasks: tasks to skip (not task_ids)
:par... | def skip(self, dag_run, execution_date, tasks, session=None):
"""
Sets tasks instances to skipped from the same dag run.
:param dag_run: the DagRun for which to set the tasks to skipped
:param execution_date: execution_date
:param tasks: tasks to skip (not task_ids)
:par... | [
"Sets",
"tasks",
"instances",
"to",
"skipped",
"from",
"the",
"same",
"dag",
"run",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/models/skipmixin.py#L29-L66 | [
"def",
"skip",
"(",
"self",
",",
"dag_run",
",",
"execution_date",
",",
"tasks",
",",
"session",
"=",
"None",
")",
":",
"if",
"not",
"tasks",
":",
"return",
"task_ids",
"=",
"[",
"d",
".",
"task_id",
"for",
"d",
"in",
"tasks",
"]",
"now",
"=",
"tim... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureDataLakeHook.get_conn | Return a AzureDLFileSystem object. | airflow/contrib/hooks/azure_data_lake_hook.py | def get_conn(self):
"""Return a AzureDLFileSystem object."""
conn = self.get_connection(self.conn_id)
service_options = conn.extra_dejson
self.account_name = service_options.get('account_name')
adlCreds = lib.auth(tenant_id=service_options.get('tenant'),
... | def get_conn(self):
"""Return a AzureDLFileSystem object."""
conn = self.get_connection(self.conn_id)
service_options = conn.extra_dejson
self.account_name = service_options.get('account_name')
adlCreds = lib.auth(tenant_id=service_options.get('tenant'),
... | [
"Return",
"a",
"AzureDLFileSystem",
"object",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_data_lake_hook.py#L41-L53 | [
"def",
"get_conn",
"(",
"self",
")",
":",
"conn",
"=",
"self",
".",
"get_connection",
"(",
"self",
".",
"conn_id",
")",
"service_options",
"=",
"conn",
".",
"extra_dejson",
"self",
".",
"account_name",
"=",
"service_options",
".",
"get",
"(",
"'account_name'... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureDataLakeHook.check_for_file | Check if a file exists on Azure Data Lake.
:param file_path: Path and name of the file.
:type file_path: str
:return: True if the file exists, False otherwise.
:rtype: bool | airflow/contrib/hooks/azure_data_lake_hook.py | def check_for_file(self, file_path):
"""
Check if a file exists on Azure Data Lake.
:param file_path: Path and name of the file.
:type file_path: str
:return: True if the file exists, False otherwise.
:rtype: bool
"""
try:
files = self.connect... | def check_for_file(self, file_path):
"""
Check if a file exists on Azure Data Lake.
:param file_path: Path and name of the file.
:type file_path: str
:return: True if the file exists, False otherwise.
:rtype: bool
"""
try:
files = self.connect... | [
"Check",
"if",
"a",
"file",
"exists",
"on",
"Azure",
"Data",
"Lake",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_data_lake_hook.py#L55-L68 | [
"def",
"check_for_file",
"(",
"self",
",",
"file_path",
")",
":",
"try",
":",
"files",
"=",
"self",
".",
"connection",
".",
"glob",
"(",
"file_path",
",",
"details",
"=",
"False",
",",
"invalidate_cache",
"=",
"True",
")",
"return",
"len",
"(",
"files",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureDataLakeHook.upload_file | Upload a file to Azure Data Lake.
:param local_path: local path. Can be single file, directory (in which case,
upload recursively) or glob pattern. Recursive glob patterns using `**`
are not supported.
:type local_path: str
:param remote_path: Remote path to upload to; i... | airflow/contrib/hooks/azure_data_lake_hook.py | def upload_file(self, local_path, remote_path, nthreads=64, overwrite=True,
buffersize=4194304, blocksize=4194304):
"""
Upload a file to Azure Data Lake.
:param local_path: local path. Can be single file, directory (in which case,
upload recursively) or glob patt... | def upload_file(self, local_path, remote_path, nthreads=64, overwrite=True,
buffersize=4194304, blocksize=4194304):
"""
Upload a file to Azure Data Lake.
:param local_path: local path. Can be single file, directory (in which case,
upload recursively) or glob patt... | [
"Upload",
"a",
"file",
"to",
"Azure",
"Data",
"Lake",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_data_lake_hook.py#L70-L104 | [
"def",
"upload_file",
"(",
"self",
",",
"local_path",
",",
"remote_path",
",",
"nthreads",
"=",
"64",
",",
"overwrite",
"=",
"True",
",",
"buffersize",
"=",
"4194304",
",",
"blocksize",
"=",
"4194304",
")",
":",
"multithread",
".",
"ADLUploader",
"(",
"sel... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureDataLakeHook.download_file | Download a file from Azure Blob Storage.
:param local_path: local path. If downloading a single file, will write to this
specific file, unless it is an existing directory, in which case a file is
created within it. If downloading multiple files, this is the root
directory to... | airflow/contrib/hooks/azure_data_lake_hook.py | def download_file(self, local_path, remote_path, nthreads=64, overwrite=True,
buffersize=4194304, blocksize=4194304):
"""
Download a file from Azure Blob Storage.
:param local_path: local path. If downloading a single file, will write to this
specific file, unl... | def download_file(self, local_path, remote_path, nthreads=64, overwrite=True,
buffersize=4194304, blocksize=4194304):
"""
Download a file from Azure Blob Storage.
:param local_path: local path. If downloading a single file, will write to this
specific file, unl... | [
"Download",
"a",
"file",
"from",
"Azure",
"Blob",
"Storage",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_data_lake_hook.py#L106-L141 | [
"def",
"download_file",
"(",
"self",
",",
"local_path",
",",
"remote_path",
",",
"nthreads",
"=",
"64",
",",
"overwrite",
"=",
"True",
",",
"buffersize",
"=",
"4194304",
",",
"blocksize",
"=",
"4194304",
")",
":",
"multithread",
".",
"ADLDownloader",
"(",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureDataLakeHook.list | List files in Azure Data Lake Storage
:param path: full path/globstring to use to list files in ADLS
:type path: str | airflow/contrib/hooks/azure_data_lake_hook.py | def list(self, path):
"""
List files in Azure Data Lake Storage
:param path: full path/globstring to use to list files in ADLS
:type path: str
"""
if "*" in path:
return self.connection.glob(path)
else:
return self.connection.walk(path) | def list(self, path):
"""
List files in Azure Data Lake Storage
:param path: full path/globstring to use to list files in ADLS
:type path: str
"""
if "*" in path:
return self.connection.glob(path)
else:
return self.connection.walk(path) | [
"List",
"files",
"in",
"Azure",
"Data",
"Lake",
"Storage"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_data_lake_hook.py#L143-L153 | [
"def",
"list",
"(",
"self",
",",
"path",
")",
":",
"if",
"\"*\"",
"in",
"path",
":",
"return",
"self",
".",
"connection",
".",
"glob",
"(",
"path",
")",
"else",
":",
"return",
"self",
".",
"connection",
".",
"walk",
"(",
"path",
")"
] | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AWSAthenaOperator.execute | Run Presto Query on Athena | airflow/contrib/operators/aws_athena_operator.py | def execute(self, context):
"""
Run Presto Query on Athena
"""
self.hook = self.get_hook()
self.hook.get_conn()
self.query_execution_context['Database'] = self.database
self.result_configuration['OutputLocation'] = self.output_location
self.query_executio... | def execute(self, context):
"""
Run Presto Query on Athena
"""
self.hook = self.get_hook()
self.hook.get_conn()
self.query_execution_context['Database'] = self.database
self.result_configuration['OutputLocation'] = self.output_location
self.query_executio... | [
"Run",
"Presto",
"Query",
"on",
"Athena"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/aws_athena_operator.py#L70-L91 | [
"def",
"execute",
"(",
"self",
",",
"context",
")",
":",
"self",
".",
"hook",
"=",
"self",
".",
"get_hook",
"(",
")",
"self",
".",
"hook",
".",
"get_conn",
"(",
")",
"self",
".",
"query_execution_context",
"[",
"'Database'",
"]",
"=",
"self",
".",
"d... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AWSAthenaOperator.on_kill | Cancel the submitted athena query | airflow/contrib/operators/aws_athena_operator.py | def on_kill(self):
"""
Cancel the submitted athena query
"""
if self.query_execution_id:
self.log.info('⚰️⚰️⚰️ Received a kill Signal. Time to Die')
self.log.info(
'Stopping Query with executionId - %s', self.query_execution_id
)
... | def on_kill(self):
"""
Cancel the submitted athena query
"""
if self.query_execution_id:
self.log.info('⚰️⚰️⚰️ Received a kill Signal. Time to Die')
self.log.info(
'Stopping Query with executionId - %s', self.query_execution_id
)
... | [
"Cancel",
"the",
"submitted",
"athena",
"query"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/aws_athena_operator.py#L93-L115 | [
"def",
"on_kill",
"(",
"self",
")",
":",
"if",
"self",
".",
"query_execution_id",
":",
"self",
".",
"log",
".",
"info",
"(",
"'⚰️⚰️⚰️ Received a kill Signal. Time to Die')",
"",
"self",
".",
"log",
".",
"info",
"(",
"'Stopping Query with executionId - %s'",
",",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | uncompress_file | Uncompress gz and bz2 files | airflow/utils/compression.py | def uncompress_file(input_file_name, file_extension, dest_dir):
"""
Uncompress gz and bz2 files
"""
if file_extension.lower() not in ('.gz', '.bz2'):
raise NotImplementedError("Received {} format. Only gz and bz2 "
"files can currently be uncompressed."
... | def uncompress_file(input_file_name, file_extension, dest_dir):
"""
Uncompress gz and bz2 files
"""
if file_extension.lower() not in ('.gz', '.bz2'):
raise NotImplementedError("Received {} format. Only gz and bz2 "
"files can currently be uncompressed."
... | [
"Uncompress",
"gz",
"and",
"bz2",
"files"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/compression.py#L26-L43 | [
"def",
"uncompress_file",
"(",
"input_file_name",
",",
"file_extension",
",",
"dest_dir",
")",
":",
"if",
"file_extension",
".",
"lower",
"(",
")",
"not",
"in",
"(",
"'.gz'",
",",
"'.bz2'",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"Received {} format. On... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MsSqlToGoogleCloudStorageOperator._query_mssql | Queries MSSQL and returns a cursor of results.
:return: mssql cursor | airflow/contrib/operators/mssql_to_gcs.py | def _query_mssql(self):
"""
Queries MSSQL and returns a cursor of results.
:return: mssql cursor
"""
mssql = MsSqlHook(mssql_conn_id=self.mssql_conn_id)
conn = mssql.get_conn()
cursor = conn.cursor()
cursor.execute(self.sql)
return cursor | def _query_mssql(self):
"""
Queries MSSQL and returns a cursor of results.
:return: mssql cursor
"""
mssql = MsSqlHook(mssql_conn_id=self.mssql_conn_id)
conn = mssql.get_conn()
cursor = conn.cursor()
cursor.execute(self.sql)
return cursor | [
"Queries",
"MSSQL",
"and",
"returns",
"a",
"cursor",
"of",
"results",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/mssql_to_gcs.py#L127-L137 | [
"def",
"_query_mssql",
"(",
"self",
")",
":",
"mssql",
"=",
"MsSqlHook",
"(",
"mssql_conn_id",
"=",
"self",
".",
"mssql_conn_id",
")",
"conn",
"=",
"mssql",
".",
"get_conn",
"(",
")",
"cursor",
"=",
"conn",
".",
"cursor",
"(",
")",
"cursor",
".",
"exec... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MsSqlToGoogleCloudStorageOperator._write_local_data_files | Takes a cursor, and writes results to a local file.
:return: A dictionary where keys are filenames to be used as object
names in GCS, and values are file handles to local files that
contain the data for the GCS objects. | airflow/contrib/operators/mssql_to_gcs.py | def _write_local_data_files(self, cursor):
"""
Takes a cursor, and writes results to a local file.
:return: A dictionary where keys are filenames to be used as object
names in GCS, and values are file handles to local files that
contain the data for the GCS objects.
... | def _write_local_data_files(self, cursor):
"""
Takes a cursor, and writes results to a local file.
:return: A dictionary where keys are filenames to be used as object
names in GCS, and values are file handles to local files that
contain the data for the GCS objects.
... | [
"Takes",
"a",
"cursor",
"and",
"writes",
"results",
"to",
"a",
"local",
"file",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/mssql_to_gcs.py#L139-L170 | [
"def",
"_write_local_data_files",
"(",
"self",
",",
"cursor",
")",
":",
"schema",
"=",
"list",
"(",
"map",
"(",
"lambda",
"schema_tuple",
":",
"schema_tuple",
"[",
"0",
"]",
".",
"replace",
"(",
"' '",
",",
"'_'",
")",
",",
"cursor",
".",
"description",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MsSqlToGoogleCloudStorageOperator._upload_to_gcs | Upload all of the file splits (and optionally the schema .json file) to
Google cloud storage. | airflow/contrib/operators/mssql_to_gcs.py | def _upload_to_gcs(self, files_to_upload):
"""
Upload all of the file splits (and optionally the schema .json file) to
Google cloud storage.
"""
hook = GoogleCloudStorageHook(
google_cloud_storage_conn_id=self.google_cloud_storage_conn_id,
delegate_to=self... | def _upload_to_gcs(self, files_to_upload):
"""
Upload all of the file splits (and optionally the schema .json file) to
Google cloud storage.
"""
hook = GoogleCloudStorageHook(
google_cloud_storage_conn_id=self.google_cloud_storage_conn_id,
delegate_to=self... | [
"Upload",
"all",
"of",
"the",
"file",
"splits",
"(",
"and",
"optionally",
"the",
"schema",
".",
"json",
"file",
")",
"to",
"Google",
"cloud",
"storage",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/mssql_to_gcs.py#L201-L211 | [
"def",
"_upload_to_gcs",
"(",
"self",
",",
"files_to_upload",
")",
":",
"hook",
"=",
"GoogleCloudStorageHook",
"(",
"google_cloud_storage_conn_id",
"=",
"self",
".",
"google_cloud_storage_conn_id",
",",
"delegate_to",
"=",
"self",
".",
"delegate_to",
")",
"for",
"ob... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MsSqlToGoogleCloudStorageOperator.convert_types | Takes a value from MSSQL, and converts it to a value that's safe for
JSON/Google Cloud Storage/BigQuery. | airflow/contrib/operators/mssql_to_gcs.py | def convert_types(cls, value):
"""
Takes a value from MSSQL, and converts it to a value that's safe for
JSON/Google Cloud Storage/BigQuery.
"""
if isinstance(value, decimal.Decimal):
return float(value)
else:
return value | def convert_types(cls, value):
"""
Takes a value from MSSQL, and converts it to a value that's safe for
JSON/Google Cloud Storage/BigQuery.
"""
if isinstance(value, decimal.Decimal):
return float(value)
else:
return value | [
"Takes",
"a",
"value",
"from",
"MSSQL",
"and",
"converts",
"it",
"to",
"a",
"value",
"that",
"s",
"safe",
"for",
"JSON",
"/",
"Google",
"Cloud",
"Storage",
"/",
"BigQuery",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/mssql_to_gcs.py#L214-L222 | [
"def",
"convert_types",
"(",
"cls",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"decimal",
".",
"Decimal",
")",
":",
"return",
"float",
"(",
"value",
")",
"else",
":",
"return",
"value"
] | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | action_logging | Decorates function to execute function at the same time submitting action_logging
but in CLI context. It will call action logger callbacks twice,
one for pre-execution and the other one for post-execution.
Action logger will be called with below keyword parameters:
sub_command : name of sub-command... | airflow/utils/cli.py | def action_logging(f):
"""
Decorates function to execute function at the same time submitting action_logging
but in CLI context. It will call action logger callbacks twice,
one for pre-execution and the other one for post-execution.
Action logger will be called with below keyword parameters:
... | def action_logging(f):
"""
Decorates function to execute function at the same time submitting action_logging
but in CLI context. It will call action logger callbacks twice,
one for pre-execution and the other one for post-execution.
Action logger will be called with below keyword parameters:
... | [
"Decorates",
"function",
"to",
"execute",
"function",
"at",
"the",
"same",
"time",
"submitting",
"action_logging",
"but",
"in",
"CLI",
"context",
".",
"It",
"will",
"call",
"action",
"logger",
"callbacks",
"twice",
"one",
"for",
"pre",
"-",
"execution",
"and",... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/cli.py#L36-L81 | [
"def",
"action_logging",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\"\"\n An wrapper for cli functions. It assumes to have Namespace instance\n at 1st posi... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | _build_metrics | Builds metrics dict from function args
It assumes that function arguments is from airflow.bin.cli module's function
and has Namespace instance where it optionally contains "dag_id", "task_id",
and "execution_date".
:param func_name: name of function
:param namespace: Namespace instance from argpars... | airflow/utils/cli.py | def _build_metrics(func_name, namespace):
"""
Builds metrics dict from function args
It assumes that function arguments is from airflow.bin.cli module's function
and has Namespace instance where it optionally contains "dag_id", "task_id",
and "execution_date".
:param func_name: name of function... | def _build_metrics(func_name, namespace):
"""
Builds metrics dict from function args
It assumes that function arguments is from airflow.bin.cli module's function
and has Namespace instance where it optionally contains "dag_id", "task_id",
and "execution_date".
:param func_name: name of function... | [
"Builds",
"metrics",
"dict",
"from",
"function",
"args",
"It",
"assumes",
"that",
"function",
"arguments",
"is",
"from",
"airflow",
".",
"bin",
".",
"cli",
"module",
"s",
"function",
"and",
"has",
"Namespace",
"instance",
"where",
"it",
"optionally",
"contains... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/cli.py#L84-L116 | [
"def",
"_build_metrics",
"(",
"func_name",
",",
"namespace",
")",
":",
"metrics",
"=",
"{",
"'sub_command'",
":",
"func_name",
",",
"'start_datetime'",
":",
"datetime",
".",
"utcnow",
"(",
")",
",",
"'full_command'",
":",
"'{}'",
".",
"format",
"(",
"list",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | TriggerRuleDep._evaluate_trigger_rule | Yields a dependency status that indicate whether the given task instance's trigger
rule was met.
:param ti: the task instance to evaluate the trigger rule of
:type ti: airflow.models.TaskInstance
:param successes: Number of successful upstream tasks
:type successes: bool
... | airflow/ti_deps/deps/trigger_rule_dep.py | def _evaluate_trigger_rule(
self,
ti,
successes,
skipped,
failed,
upstream_failed,
done,
flag_upstream_failed,
session):
"""
Yields a dependency status that indicate whether the given task instanc... | def _evaluate_trigger_rule(
self,
ti,
successes,
skipped,
failed,
upstream_failed,
done,
flag_upstream_failed,
session):
"""
Yields a dependency status that indicate whether the given task instanc... | [
"Yields",
"a",
"dependency",
"status",
"that",
"indicate",
"whether",
"the",
"given",
"task",
"instance",
"s",
"trigger",
"rule",
"was",
"met",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/ti_deps/deps/trigger_rule_dep.py#L91-L224 | [
"def",
"_evaluate_trigger_rule",
"(",
"self",
",",
"ti",
",",
"successes",
",",
"skipped",
",",
"failed",
",",
"upstream_failed",
",",
"done",
",",
"flag_upstream_failed",
",",
"session",
")",
":",
"TR",
"=",
"airflow",
".",
"utils",
".",
"trigger_rule",
"."... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | CgroupTaskRunner._create_cgroup | Create the specified cgroup.
:param path: The path of the cgroup to create.
E.g. cpu/mygroup/mysubgroup
:return: the Node associated with the created cgroup.
:rtype: cgroupspy.nodes.Node | airflow/contrib/task_runner/cgroup_task_runner.py | def _create_cgroup(self, path):
"""
Create the specified cgroup.
:param path: The path of the cgroup to create.
E.g. cpu/mygroup/mysubgroup
:return: the Node associated with the created cgroup.
:rtype: cgroupspy.nodes.Node
"""
node = trees.Tree().root
... | def _create_cgroup(self, path):
"""
Create the specified cgroup.
:param path: The path of the cgroup to create.
E.g. cpu/mygroup/mysubgroup
:return: the Node associated with the created cgroup.
:rtype: cgroupspy.nodes.Node
"""
node = trees.Tree().root
... | [
"Create",
"the",
"specified",
"cgroup",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/task_runner/cgroup_task_runner.py#L66-L88 | [
"def",
"_create_cgroup",
"(",
"self",
",",
"path",
")",
":",
"node",
"=",
"trees",
".",
"Tree",
"(",
")",
".",
"root",
"path_split",
"=",
"path",
".",
"split",
"(",
"os",
".",
"sep",
")",
"for",
"path_element",
"in",
"path_split",
":",
"name_to_node",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | CgroupTaskRunner._delete_cgroup | Delete the specified cgroup.
:param path: The path of the cgroup to delete.
E.g. cpu/mygroup/mysubgroup | airflow/contrib/task_runner/cgroup_task_runner.py | def _delete_cgroup(self, path):
"""
Delete the specified cgroup.
:param path: The path of the cgroup to delete.
E.g. cpu/mygroup/mysubgroup
"""
node = trees.Tree().root
path_split = path.split("/")
for path_element in path_split:
name_to_node ... | def _delete_cgroup(self, path):
"""
Delete the specified cgroup.
:param path: The path of the cgroup to delete.
E.g. cpu/mygroup/mysubgroup
"""
node = trees.Tree().root
path_split = path.split("/")
for path_element in path_split:
name_to_node ... | [
"Delete",
"the",
"specified",
"cgroup",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/task_runner/cgroup_task_runner.py#L90-L109 | [
"def",
"_delete_cgroup",
"(",
"self",
",",
"path",
")",
":",
"node",
"=",
"trees",
".",
"Tree",
"(",
")",
".",
"root",
"path_split",
"=",
"path",
".",
"split",
"(",
"\"/\"",
")",
"for",
"path_element",
"in",
"path_split",
":",
"name_to_node",
"=",
"{",... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | CgroupTaskRunner._get_cgroup_names | :return: a mapping between the subsystem name to the cgroup name
:rtype: dict[str, str] | airflow/contrib/task_runner/cgroup_task_runner.py | def _get_cgroup_names():
"""
:return: a mapping between the subsystem name to the cgroup name
:rtype: dict[str, str]
"""
with open("/proc/self/cgroup") as f:
lines = f.readlines()
d = {}
for line in lines:
line_split = line.rstr... | def _get_cgroup_names():
"""
:return: a mapping between the subsystem name to the cgroup name
:rtype: dict[str, str]
"""
with open("/proc/self/cgroup") as f:
lines = f.readlines()
d = {}
for line in lines:
line_split = line.rstr... | [
":",
"return",
":",
"a",
"mapping",
"between",
"the",
"subsystem",
"name",
"to",
"the",
"cgroup",
"name",
":",
"rtype",
":",
"dict",
"[",
"str",
"str",
"]"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/task_runner/cgroup_task_runner.py#L197-L210 | [
"def",
"_get_cgroup_names",
"(",
")",
":",
"with",
"open",
"(",
"\"/proc/self/cgroup\"",
")",
"as",
"f",
":",
"lines",
"=",
"f",
".",
"readlines",
"(",
")",
"d",
"=",
"{",
"}",
"for",
"line",
"in",
"lines",
":",
"line_split",
"=",
"line",
".",
"rstri... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | DatabricksHook._parse_host | The purpose of this function is to be robust to improper connections
settings provided by users, specifically in the host field.
For example -- when users supply ``https://xx.cloud.databricks.com`` as the
host, we must strip out the protocol to get the host.::
h = DatabricksHook()
... | airflow/contrib/hooks/databricks_hook.py | def _parse_host(host):
"""
The purpose of this function is to be robust to improper connections
settings provided by users, specifically in the host field.
For example -- when users supply ``https://xx.cloud.databricks.com`` as the
host, we must strip out the protocol to get the... | def _parse_host(host):
"""
The purpose of this function is to be robust to improper connections
settings provided by users, specifically in the host field.
For example -- when users supply ``https://xx.cloud.databricks.com`` as the
host, we must strip out the protocol to get the... | [
"The",
"purpose",
"of",
"this",
"function",
"is",
"to",
"be",
"robust",
"to",
"improper",
"connections",
"settings",
"provided",
"by",
"users",
"specifically",
"in",
"the",
"host",
"field",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/databricks_hook.py#L73-L97 | [
"def",
"_parse_host",
"(",
"host",
")",
":",
"urlparse_host",
"=",
"urlparse",
".",
"urlparse",
"(",
"host",
")",
".",
"hostname",
"if",
"urlparse_host",
":",
"# In this case, host = https://xx.cloud.databricks.com",
"return",
"urlparse_host",
"else",
":",
"# In this ... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | DatabricksHook._do_api_call | Utility function to perform an API call with retries
:param endpoint_info: Tuple of method and endpoint
:type endpoint_info: tuple[string, string]
:param json: Parameters for this API call.
:type json: dict
:return: If the api call returns a OK status code,
this func... | airflow/contrib/hooks/databricks_hook.py | def _do_api_call(self, endpoint_info, json):
"""
Utility function to perform an API call with retries
:param endpoint_info: Tuple of method and endpoint
:type endpoint_info: tuple[string, string]
:param json: Parameters for this API call.
:type json: dict
:return... | def _do_api_call(self, endpoint_info, json):
"""
Utility function to perform an API call with retries
:param endpoint_info: Tuple of method and endpoint
:type endpoint_info: tuple[string, string]
:param json: Parameters for this API call.
:type json: dict
:return... | [
"Utility",
"function",
"to",
"perform",
"an",
"API",
"call",
"with",
"retries"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/databricks_hook.py#L99-L154 | [
"def",
"_do_api_call",
"(",
"self",
",",
"endpoint_info",
",",
"json",
")",
":",
"method",
",",
"endpoint",
"=",
"endpoint_info",
"url",
"=",
"'https://{host}/{endpoint}'",
".",
"format",
"(",
"host",
"=",
"self",
".",
"_parse_host",
"(",
"self",
".",
"datab... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | SalesforceHook.get_conn | Sign into Salesforce, only if we are not already signed in. | airflow/contrib/hooks/salesforce_hook.py | def get_conn(self):
"""
Sign into Salesforce, only if we are not already signed in.
"""
if not self.conn:
connection = self.get_connection(self.conn_id)
extras = connection.extra_dejson
self.conn = Salesforce(
username=connection.login,... | def get_conn(self):
"""
Sign into Salesforce, only if we are not already signed in.
"""
if not self.conn:
connection = self.get_connection(self.conn_id)
extras = connection.extra_dejson
self.conn = Salesforce(
username=connection.login,... | [
"Sign",
"into",
"Salesforce",
"only",
"if",
"we",
"are",
"not",
"already",
"signed",
"in",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/salesforce_hook.py#L60-L74 | [
"def",
"get_conn",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"conn",
":",
"connection",
"=",
"self",
".",
"get_connection",
"(",
"self",
".",
"conn_id",
")",
"extras",
"=",
"connection",
".",
"extra_dejson",
"self",
".",
"conn",
"=",
"Salesforce",... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | SalesforceHook.make_query | Make a query to Salesforce.
:param query: The query to make to Salesforce.
:type query: str
:return: The query result.
:rtype: dict | airflow/contrib/hooks/salesforce_hook.py | def make_query(self, query):
"""
Make a query to Salesforce.
:param query: The query to make to Salesforce.
:type query: str
:return: The query result.
:rtype: dict
"""
conn = self.get_conn()
self.log.info("Querying for all objects")
quer... | def make_query(self, query):
"""
Make a query to Salesforce.
:param query: The query to make to Salesforce.
:type query: str
:return: The query result.
:rtype: dict
"""
conn = self.get_conn()
self.log.info("Querying for all objects")
quer... | [
"Make",
"a",
"query",
"to",
"Salesforce",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/salesforce_hook.py#L76-L93 | [
"def",
"make_query",
"(",
"self",
",",
"query",
")",
":",
"conn",
"=",
"self",
".",
"get_conn",
"(",
")",
"self",
".",
"log",
".",
"info",
"(",
"\"Querying for all objects\"",
")",
"query_results",
"=",
"conn",
".",
"query_all",
"(",
"query",
")",
"self"... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | SalesforceHook.describe_object | Get the description of an object from Salesforce.
This description is the object's schema and
some extra metadata that Salesforce stores for each object.
:param obj: The name of the Salesforce object that we are getting a description of.
:type obj: str
:return: the description o... | airflow/contrib/hooks/salesforce_hook.py | def describe_object(self, obj):
"""
Get the description of an object from Salesforce.
This description is the object's schema and
some extra metadata that Salesforce stores for each object.
:param obj: The name of the Salesforce object that we are getting a description of.
... | def describe_object(self, obj):
"""
Get the description of an object from Salesforce.
This description is the object's schema and
some extra metadata that Salesforce stores for each object.
:param obj: The name of the Salesforce object that we are getting a description of.
... | [
"Get",
"the",
"description",
"of",
"an",
"object",
"from",
"Salesforce",
".",
"This",
"description",
"is",
"the",
"object",
"s",
"schema",
"and",
"some",
"extra",
"metadata",
"that",
"Salesforce",
"stores",
"for",
"each",
"object",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/salesforce_hook.py#L95-L108 | [
"def",
"describe_object",
"(",
"self",
",",
"obj",
")",
":",
"conn",
"=",
"self",
".",
"get_conn",
"(",
")",
"return",
"conn",
".",
"__getattr__",
"(",
"obj",
")",
".",
"describe",
"(",
")"
] | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | SalesforceHook.get_available_fields | Get a list of all available fields for an object.
:param obj: The name of the Salesforce object that we are getting a description of.
:type obj: str
:return: the names of the fields.
:rtype: list of str | airflow/contrib/hooks/salesforce_hook.py | def get_available_fields(self, obj):
"""
Get a list of all available fields for an object.
:param obj: The name of the Salesforce object that we are getting a description of.
:type obj: str
:return: the names of the fields.
:rtype: list of str
"""
self.ge... | def get_available_fields(self, obj):
"""
Get a list of all available fields for an object.
:param obj: The name of the Salesforce object that we are getting a description of.
:type obj: str
:return: the names of the fields.
:rtype: list of str
"""
self.ge... | [
"Get",
"a",
"list",
"of",
"all",
"available",
"fields",
"for",
"an",
"object",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/salesforce_hook.py#L110-L123 | [
"def",
"get_available_fields",
"(",
"self",
",",
"obj",
")",
":",
"self",
".",
"get_conn",
"(",
")",
"obj_description",
"=",
"self",
".",
"describe_object",
"(",
"obj",
")",
"return",
"[",
"field",
"[",
"'name'",
"]",
"for",
"field",
"in",
"obj_description... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | SalesforceHook.get_object_from_salesforce | Get all instances of the `object` from Salesforce.
For each model, only get the fields specified in fields.
All we really do underneath the hood is run:
SELECT <fields> FROM <obj>;
:param obj: The object name to get from Salesforce.
:type obj: str
:param fields: The... | airflow/contrib/hooks/salesforce_hook.py | def get_object_from_salesforce(self, obj, fields):
"""
Get all instances of the `object` from Salesforce.
For each model, only get the fields specified in fields.
All we really do underneath the hood is run:
SELECT <fields> FROM <obj>;
:param obj: The object name to... | def get_object_from_salesforce(self, obj, fields):
"""
Get all instances of the `object` from Salesforce.
For each model, only get the fields specified in fields.
All we really do underneath the hood is run:
SELECT <fields> FROM <obj>;
:param obj: The object name to... | [
"Get",
"all",
"instances",
"of",
"the",
"object",
"from",
"Salesforce",
".",
"For",
"each",
"model",
"only",
"get",
"the",
"fields",
"specified",
"in",
"fields",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/salesforce_hook.py#L125-L145 | [
"def",
"get_object_from_salesforce",
"(",
"self",
",",
"obj",
",",
"fields",
")",
":",
"query",
"=",
"\"SELECT {} FROM {}\"",
".",
"format",
"(",
"\",\"",
".",
"join",
"(",
"fields",
")",
",",
"obj",
")",
"self",
".",
"log",
".",
"info",
"(",
"\"Making q... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | SalesforceHook._to_timestamp | Convert a column of a dataframe to UNIX timestamps if applicable
:param column: A Series object representing a column of a dataframe.
:type column: pd.Series
:return: a new series that maintains the same index as the original
:rtype: pd.Series | airflow/contrib/hooks/salesforce_hook.py | def _to_timestamp(cls, column):
"""
Convert a column of a dataframe to UNIX timestamps if applicable
:param column: A Series object representing a column of a dataframe.
:type column: pd.Series
:return: a new series that maintains the same index as the original
:rtype: p... | def _to_timestamp(cls, column):
"""
Convert a column of a dataframe to UNIX timestamps if applicable
:param column: A Series object representing a column of a dataframe.
:type column: pd.Series
:return: a new series that maintains the same index as the original
:rtype: p... | [
"Convert",
"a",
"column",
"of",
"a",
"dataframe",
"to",
"UNIX",
"timestamps",
"if",
"applicable"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/salesforce_hook.py#L148-L184 | [
"def",
"_to_timestamp",
"(",
"cls",
",",
"column",
")",
":",
"# try and convert the column to datetimes",
"# the column MUST have a four digit year somewhere in the string",
"# there should be a better way to do this,",
"# but just letting pandas try and convert every column without a format",... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | SalesforceHook.write_object_to_file | Write query results to file.
Acceptable formats are:
- csv:
comma-separated-values file. This is the default format.
- json:
JSON array. Each element in the array is a different row.
- ndjson:
JSON array but each element is new... | airflow/contrib/hooks/salesforce_hook.py | def write_object_to_file(self,
query_results,
filename,
fmt="csv",
coerce_to_timestamp=False,
record_time_added=False):
"""
Write query results to file.
... | def write_object_to_file(self,
query_results,
filename,
fmt="csv",
coerce_to_timestamp=False,
record_time_added=False):
"""
Write query results to file.
... | [
"Write",
"query",
"results",
"to",
"file",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/salesforce_hook.py#L186-L293 | [
"def",
"write_object_to_file",
"(",
"self",
",",
"query_results",
",",
"filename",
",",
"fmt",
"=",
"\"csv\"",
",",
"coerce_to_timestamp",
"=",
"False",
",",
"record_time_added",
"=",
"False",
")",
":",
"fmt",
"=",
"fmt",
".",
"lower",
"(",
")",
"if",
"fmt... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | GCSTaskHandler._read | Read logs of given task instance and try_number from GCS.
If failed, read the log from task instance host machine.
:param ti: task instance object
:param try_number: task instance try_number to read logs from
:param metadata: log metadata,
can be used for steamin... | airflow/utils/log/gcs_task_handler.py | def _read(self, ti, try_number, metadata=None):
"""
Read logs of given task instance and try_number from GCS.
If failed, read the log from task instance host machine.
:param ti: task instance object
:param try_number: task instance try_number to read logs from
:param meta... | def _read(self, ti, try_number, metadata=None):
"""
Read logs of given task instance and try_number from GCS.
If failed, read the log from task instance host machine.
:param ti: task instance object
:param try_number: task instance try_number to read logs from
:param meta... | [
"Read",
"logs",
"of",
"given",
"task",
"instance",
"and",
"try_number",
"from",
"GCS",
".",
"If",
"failed",
"read",
"the",
"log",
"from",
"task",
"instance",
"host",
"machine",
".",
":",
"param",
"ti",
":",
"task",
"instance",
"object",
":",
"param",
"tr... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/log/gcs_task_handler.py#L95-L121 | [
"def",
"_read",
"(",
"self",
",",
"ti",
",",
"try_number",
",",
"metadata",
"=",
"None",
")",
":",
"# Explicitly getting log relative path is necessary as the given",
"# task instance might be different than task instance passed in",
"# in set_context method.",
"log_relative_path",... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | GCSTaskHandler.gcs_read | Returns the log found at the remote_log_location.
:param remote_log_location: the log's location in remote storage
:type remote_log_location: str (path) | airflow/utils/log/gcs_task_handler.py | def gcs_read(self, remote_log_location):
"""
Returns the log found at the remote_log_location.
:param remote_log_location: the log's location in remote storage
:type remote_log_location: str (path)
"""
bkt, blob = self.parse_gcs_url(remote_log_location)
return sel... | def gcs_read(self, remote_log_location):
"""
Returns the log found at the remote_log_location.
:param remote_log_location: the log's location in remote storage
:type remote_log_location: str (path)
"""
bkt, blob = self.parse_gcs_url(remote_log_location)
return sel... | [
"Returns",
"the",
"log",
"found",
"at",
"the",
"remote_log_location",
".",
":",
"param",
"remote_log_location",
":",
"the",
"log",
"s",
"location",
"in",
"remote",
"storage",
":",
"type",
"remote_log_location",
":",
"str",
"(",
"path",
")"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/log/gcs_task_handler.py#L123-L130 | [
"def",
"gcs_read",
"(",
"self",
",",
"remote_log_location",
")",
":",
"bkt",
",",
"blob",
"=",
"self",
".",
"parse_gcs_url",
"(",
"remote_log_location",
")",
"return",
"self",
".",
"hook",
".",
"download",
"(",
"bkt",
",",
"blob",
")",
".",
"decode",
"("... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | GCSTaskHandler.gcs_write | Writes the log to the remote_log_location. Fails silently if no hook
was created.
:param log: the log to write to the remote_log_location
:type log: str
:param remote_log_location: the log's location in remote storage
:type remote_log_location: str (path)
:param append: i... | airflow/utils/log/gcs_task_handler.py | def gcs_write(self, log, remote_log_location, append=True):
"""
Writes the log to the remote_log_location. Fails silently if no hook
was created.
:param log: the log to write to the remote_log_location
:type log: str
:param remote_log_location: the log's location in remot... | def gcs_write(self, log, remote_log_location, append=True):
"""
Writes the log to the remote_log_location. Fails silently if no hook
was created.
:param log: the log to write to the remote_log_location
:type log: str
:param remote_log_location: the log's location in remot... | [
"Writes",
"the",
"log",
"to",
"the",
"remote_log_location",
".",
"Fails",
"silently",
"if",
"no",
"hook",
"was",
"created",
".",
":",
"param",
"log",
":",
"the",
"log",
"to",
"write",
"to",
"the",
"remote_log_location",
":",
"type",
"log",
":",
"str",
":... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/log/gcs_task_handler.py#L132-L163 | [
"def",
"gcs_write",
"(",
"self",
",",
"log",
",",
"remote_log_location",
",",
"append",
"=",
"True",
")",
":",
"if",
"append",
":",
"try",
":",
"old_log",
"=",
"self",
".",
"gcs_read",
"(",
"remote_log_location",
")",
"log",
"=",
"'\\n'",
".",
"join",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | GCSTaskHandler.parse_gcs_url | Given a Google Cloud Storage URL (gs://<bucket>/<blob>), returns a
tuple containing the corresponding bucket and blob. | airflow/utils/log/gcs_task_handler.py | def parse_gcs_url(gsurl):
"""
Given a Google Cloud Storage URL (gs://<bucket>/<blob>), returns a
tuple containing the corresponding bucket and blob.
"""
parsed_url = urlparse(gsurl)
if not parsed_url.netloc:
raise AirflowException('Please provide a bucket name... | def parse_gcs_url(gsurl):
"""
Given a Google Cloud Storage URL (gs://<bucket>/<blob>), returns a
tuple containing the corresponding bucket and blob.
"""
parsed_url = urlparse(gsurl)
if not parsed_url.netloc:
raise AirflowException('Please provide a bucket name... | [
"Given",
"a",
"Google",
"Cloud",
"Storage",
"URL",
"(",
"gs",
":",
"//",
"<bucket",
">",
"/",
"<blob",
">",
")",
"returns",
"a",
"tuple",
"containing",
"the",
"corresponding",
"bucket",
"and",
"blob",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/log/gcs_task_handler.py#L166-L177 | [
"def",
"parse_gcs_url",
"(",
"gsurl",
")",
":",
"parsed_url",
"=",
"urlparse",
"(",
"gsurl",
")",
"if",
"not",
"parsed_url",
".",
"netloc",
":",
"raise",
"AirflowException",
"(",
"'Please provide a bucket name'",
")",
"else",
":",
"bucket",
"=",
"parsed_url",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MongoHook.get_conn | Fetches PyMongo Client | airflow/contrib/hooks/mongo_hook.py | def get_conn(self):
"""
Fetches PyMongo Client
"""
if self.client is not None:
return self.client
# Mongo Connection Options dict that is unpacked when passed to MongoClient
options = self.extras
# If we are using SSL disable requiring certs from spe... | def get_conn(self):
"""
Fetches PyMongo Client
"""
if self.client is not None:
return self.client
# Mongo Connection Options dict that is unpacked when passed to MongoClient
options = self.extras
# If we are using SSL disable requiring certs from spe... | [
"Fetches",
"PyMongo",
"Client"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/mongo_hook.py#L69-L85 | [
"def",
"get_conn",
"(",
"self",
")",
":",
"if",
"self",
".",
"client",
"is",
"not",
"None",
":",
"return",
"self",
".",
"client",
"# Mongo Connection Options dict that is unpacked when passed to MongoClient",
"options",
"=",
"self",
".",
"extras",
"# If we are using S... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MongoHook.get_collection | Fetches a mongo collection object for querying.
Uses connection schema as DB unless specified. | airflow/contrib/hooks/mongo_hook.py | def get_collection(self, mongo_collection, mongo_db=None):
"""
Fetches a mongo collection object for querying.
Uses connection schema as DB unless specified.
"""
mongo_db = mongo_db if mongo_db is not None else self.connection.schema
mongo_conn = self.get_conn()
... | def get_collection(self, mongo_collection, mongo_db=None):
"""
Fetches a mongo collection object for querying.
Uses connection schema as DB unless specified.
"""
mongo_db = mongo_db if mongo_db is not None else self.connection.schema
mongo_conn = self.get_conn()
... | [
"Fetches",
"a",
"mongo",
"collection",
"object",
"for",
"querying",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/mongo_hook.py#L93-L102 | [
"def",
"get_collection",
"(",
"self",
",",
"mongo_collection",
",",
"mongo_db",
"=",
"None",
")",
":",
"mongo_db",
"=",
"mongo_db",
"if",
"mongo_db",
"is",
"not",
"None",
"else",
"self",
".",
"connection",
".",
"schema",
"mongo_conn",
"=",
"self",
".",
"ge... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MongoHook.aggregate | Runs an aggregation pipeline and returns the results
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.aggregate
https://api.mongodb.com/python/current/examples/aggregation.html | airflow/contrib/hooks/mongo_hook.py | def aggregate(self, mongo_collection, aggregate_query, mongo_db=None, **kwargs):
"""
Runs an aggregation pipeline and returns the results
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.aggregate
https://api.mongodb.com/python/current/exam... | def aggregate(self, mongo_collection, aggregate_query, mongo_db=None, **kwargs):
"""
Runs an aggregation pipeline and returns the results
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.aggregate
https://api.mongodb.com/python/current/exam... | [
"Runs",
"an",
"aggregation",
"pipeline",
"and",
"returns",
"the",
"results",
"https",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",
... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/mongo_hook.py#L104-L112 | [
"def",
"aggregate",
"(",
"self",
",",
"mongo_collection",
",",
"aggregate_query",
",",
"mongo_db",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"collection",
"=",
"self",
".",
"get_collection",
"(",
"mongo_collection",
",",
"mongo_db",
"=",
"mongo_db",
")... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MongoHook.find | Runs a mongo find query and returns the results
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find | airflow/contrib/hooks/mongo_hook.py | def find(self, mongo_collection, query, find_one=False, mongo_db=None, **kwargs):
"""
Runs a mongo find query and returns the results
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find
"""
collection = self.get_collection(mongo_c... | def find(self, mongo_collection, query, find_one=False, mongo_db=None, **kwargs):
"""
Runs a mongo find query and returns the results
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.find
"""
collection = self.get_collection(mongo_c... | [
"Runs",
"a",
"mongo",
"find",
"query",
"and",
"returns",
"the",
"results",
"https",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",
... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/mongo_hook.py#L114-L124 | [
"def",
"find",
"(",
"self",
",",
"mongo_collection",
",",
"query",
",",
"find_one",
"=",
"False",
",",
"mongo_db",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"collection",
"=",
"self",
".",
"get_collection",
"(",
"mongo_collection",
",",
"mongo_db",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MongoHook.insert_one | Inserts a single document into a mongo collection
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_one | airflow/contrib/hooks/mongo_hook.py | def insert_one(self, mongo_collection, doc, mongo_db=None, **kwargs):
"""
Inserts a single document into a mongo collection
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_one
"""
collection = self.get_collection(mongo_colle... | def insert_one(self, mongo_collection, doc, mongo_db=None, **kwargs):
"""
Inserts a single document into a mongo collection
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_one
"""
collection = self.get_collection(mongo_colle... | [
"Inserts",
"a",
"single",
"document",
"into",
"a",
"mongo",
"collection",
"https",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",
"C... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/mongo_hook.py#L126-L133 | [
"def",
"insert_one",
"(",
"self",
",",
"mongo_collection",
",",
"doc",
",",
"mongo_db",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"collection",
"=",
"self",
".",
"get_collection",
"(",
"mongo_collection",
",",
"mongo_db",
"=",
"mongo_db",
")",
"retur... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MongoHook.insert_many | Inserts many docs into a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_many | airflow/contrib/hooks/mongo_hook.py | def insert_many(self, mongo_collection, docs, mongo_db=None, **kwargs):
"""
Inserts many docs into a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_many
"""
collection = self.get_collection(mongo_collectio... | def insert_many(self, mongo_collection, docs, mongo_db=None, **kwargs):
"""
Inserts many docs into a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.insert_many
"""
collection = self.get_collection(mongo_collectio... | [
"Inserts",
"many",
"docs",
"into",
"a",
"mongo",
"collection",
".",
"https",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",
"Collect... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/mongo_hook.py#L135-L142 | [
"def",
"insert_many",
"(",
"self",
",",
"mongo_collection",
",",
"docs",
",",
"mongo_db",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"collection",
"=",
"self",
".",
"get_collection",
"(",
"mongo_collection",
",",
"mongo_db",
"=",
"mongo_db",
")",
"ret... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MongoHook.update_one | Updates a single document in a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.update_one
:param mongo_collection: The name of the collection to update.
:type mongo_collection: str
:param filter_doc: A query that matches... | airflow/contrib/hooks/mongo_hook.py | def update_one(self, mongo_collection, filter_doc, update_doc,
mongo_db=None, **kwargs):
"""
Updates a single document in a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.update_one
:param mongo_colle... | def update_one(self, mongo_collection, filter_doc, update_doc,
mongo_db=None, **kwargs):
"""
Updates a single document in a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.update_one
:param mongo_colle... | [
"Updates",
"a",
"single",
"document",
"in",
"a",
"mongo",
"collection",
".",
"https",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/mongo_hook.py#L144-L163 | [
"def",
"update_one",
"(",
"self",
",",
"mongo_collection",
",",
"filter_doc",
",",
"update_doc",
",",
"mongo_db",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"collection",
"=",
"self",
".",
"get_collection",
"(",
"mongo_collection",
",",
"mongo_db",
"=",... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MongoHook.replace_one | Replaces a single document in a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.replace_one
.. note::
If no ``filter_doc`` is given, it is assumed that the replacement
document contain the ``_id`` field which is ... | airflow/contrib/hooks/mongo_hook.py | def replace_one(self, mongo_collection, doc, filter_doc=None,
mongo_db=None, **kwargs):
"""
Replaces a single document in a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.replace_one
.. note::
... | def replace_one(self, mongo_collection, doc, filter_doc=None,
mongo_db=None, **kwargs):
"""
Replaces a single document in a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.replace_one
.. note::
... | [
"Replaces",
"a",
"single",
"document",
"in",
"a",
"mongo",
"collection",
".",
"https",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
"."... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/mongo_hook.py#L186-L212 | [
"def",
"replace_one",
"(",
"self",
",",
"mongo_collection",
",",
"doc",
",",
"filter_doc",
"=",
"None",
",",
"mongo_db",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"collection",
"=",
"self",
".",
"get_collection",
"(",
"mongo_collection",
",",
"mongo_... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MongoHook.replace_many | Replaces many documents in a mongo collection.
Uses bulk_write with multiple ReplaceOne operations
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.bulk_write
.. note::
If no ``filter_docs``are given, it is assumed that all
... | airflow/contrib/hooks/mongo_hook.py | def replace_many(self, mongo_collection, docs,
filter_docs=None, mongo_db=None, upsert=False, collation=None,
**kwargs):
"""
Replaces many documents in a mongo collection.
Uses bulk_write with multiple ReplaceOne operations
https://api.mongodb.c... | def replace_many(self, mongo_collection, docs,
filter_docs=None, mongo_db=None, upsert=False, collation=None,
**kwargs):
"""
Replaces many documents in a mongo collection.
Uses bulk_write with multiple ReplaceOne operations
https://api.mongodb.c... | [
"Replaces",
"many",
"documents",
"in",
"a",
"mongo",
"collection",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/mongo_hook.py#L214-L261 | [
"def",
"replace_many",
"(",
"self",
",",
"mongo_collection",
",",
"docs",
",",
"filter_docs",
"=",
"None",
",",
"mongo_db",
"=",
"None",
",",
"upsert",
"=",
"False",
",",
"collation",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"collection",
"=",
"... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MongoHook.delete_one | Deletes a single document in a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.delete_one
:param mongo_collection: The name of the collection to delete from.
:type mongo_collection: str
:param filter_doc: A query that ma... | airflow/contrib/hooks/mongo_hook.py | def delete_one(self, mongo_collection, filter_doc, mongo_db=None, **kwargs):
"""
Deletes a single document in a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.delete_one
:param mongo_collection: The name of the collecti... | def delete_one(self, mongo_collection, filter_doc, mongo_db=None, **kwargs):
"""
Deletes a single document in a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.delete_one
:param mongo_collection: The name of the collecti... | [
"Deletes",
"a",
"single",
"document",
"in",
"a",
"mongo",
"collection",
".",
"https",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection",
".",... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/mongo_hook.py#L263-L279 | [
"def",
"delete_one",
"(",
"self",
",",
"mongo_collection",
",",
"filter_doc",
",",
"mongo_db",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"collection",
"=",
"self",
".",
"get_collection",
"(",
"mongo_collection",
",",
"mongo_db",
"=",
"mongo_db",
")",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MongoHook.delete_many | Deletes one or more documents in a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.delete_many
:param mongo_collection: The name of the collection to delete from.
:type mongo_collection: str
:param filter_doc: A query th... | airflow/contrib/hooks/mongo_hook.py | def delete_many(self, mongo_collection, filter_doc, mongo_db=None, **kwargs):
"""
Deletes one or more documents in a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.delete_many
:param mongo_collection: The name of the co... | def delete_many(self, mongo_collection, filter_doc, mongo_db=None, **kwargs):
"""
Deletes one or more documents in a mongo collection.
https://api.mongodb.com/python/current/api/pymongo/collection.html#pymongo.collection.Collection.delete_many
:param mongo_collection: The name of the co... | [
"Deletes",
"one",
"or",
"more",
"documents",
"in",
"a",
"mongo",
"collection",
".",
"https",
":",
"//",
"api",
".",
"mongodb",
".",
"com",
"/",
"python",
"/",
"current",
"/",
"api",
"/",
"pymongo",
"/",
"collection",
".",
"html#pymongo",
".",
"collection... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/mongo_hook.py#L281-L297 | [
"def",
"delete_many",
"(",
"self",
",",
"mongo_collection",
",",
"filter_doc",
",",
"mongo_db",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"collection",
"=",
"self",
".",
"get_collection",
"(",
"mongo_collection",
",",
"mongo_db",
"=",
"mongo_db",
")",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | ImapHook.has_mail_attachment | Checks the mail folder for mails containing attachments with the given name.
:param name: The name of the attachment that will be searched for.
:type name: str
:param mail_folder: The mail folder where to look at.
:type mail_folder: str
:param check_regex: Checks the name for a ... | airflow/contrib/hooks/imap_hook.py | def has_mail_attachment(self, name, mail_folder='INBOX', check_regex=False):
"""
Checks the mail folder for mails containing attachments with the given name.
:param name: The name of the attachment that will be searched for.
:type name: str
:param mail_folder: The mail folder wh... | def has_mail_attachment(self, name, mail_folder='INBOX', check_regex=False):
"""
Checks the mail folder for mails containing attachments with the given name.
:param name: The name of the attachment that will be searched for.
:type name: str
:param mail_folder: The mail folder wh... | [
"Checks",
"the",
"mail",
"folder",
"for",
"mails",
"containing",
"attachments",
"with",
"the",
"given",
"name",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/imap_hook.py#L49-L66 | [
"def",
"has_mail_attachment",
"(",
"self",
",",
"name",
",",
"mail_folder",
"=",
"'INBOX'",
",",
"check_regex",
"=",
"False",
")",
":",
"mail_attachments",
"=",
"self",
".",
"_retrieve_mails_attachments_by_name",
"(",
"name",
",",
"mail_folder",
",",
"check_regex"... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | ImapHook.retrieve_mail_attachments | Retrieves mail's attachments in the mail folder by its name.
:param name: The name of the attachment that will be downloaded.
:type name: str
:param mail_folder: The mail folder where to look at.
:type mail_folder: str
:param check_regex: Checks the name for a regular expression... | airflow/contrib/hooks/imap_hook.py | def retrieve_mail_attachments(self,
name,
mail_folder='INBOX',
check_regex=False,
latest_only=False,
not_found_mode='raise'):
"""
Retr... | def retrieve_mail_attachments(self,
name,
mail_folder='INBOX',
check_regex=False,
latest_only=False,
not_found_mode='raise'):
"""
Retr... | [
"Retrieves",
"mail",
"s",
"attachments",
"in",
"the",
"mail",
"folder",
"by",
"its",
"name",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/imap_hook.py#L68-L102 | [
"def",
"retrieve_mail_attachments",
"(",
"self",
",",
"name",
",",
"mail_folder",
"=",
"'INBOX'",
",",
"check_regex",
"=",
"False",
",",
"latest_only",
"=",
"False",
",",
"not_found_mode",
"=",
"'raise'",
")",
":",
"mail_attachments",
"=",
"self",
".",
"_retri... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | ImapHook.download_mail_attachments | Downloads mail's attachments in the mail folder by its name to the local directory.
:param name: The name of the attachment that will be downloaded.
:type name: str
:param local_output_directory: The output directory on the local machine
where the files wi... | airflow/contrib/hooks/imap_hook.py | def download_mail_attachments(self,
name,
local_output_directory,
mail_folder='INBOX',
check_regex=False,
latest_only=False,
... | def download_mail_attachments(self,
name,
local_output_directory,
mail_folder='INBOX',
check_regex=False,
latest_only=False,
... | [
"Downloads",
"mail",
"s",
"attachments",
"in",
"the",
"mail",
"folder",
"by",
"its",
"name",
"to",
"the",
"local",
"directory",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/imap_hook.py#L104-L141 | [
"def",
"download_mail_attachments",
"(",
"self",
",",
"name",
",",
"local_output_directory",
",",
"mail_folder",
"=",
"'INBOX'",
",",
"check_regex",
"=",
"False",
",",
"latest_only",
"=",
"False",
",",
"not_found_mode",
"=",
"'raise'",
")",
":",
"mail_attachments"... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | Mail.get_attachments_by_name | Gets all attachments by name for the mail.
:param name: The name of the attachment to look for.
:type name: str
:param check_regex: Checks the name for a regular expression.
:type check_regex: bool
:param find_first: If set to True it will only find the first match and then quit... | airflow/contrib/hooks/imap_hook.py | def get_attachments_by_name(self, name, check_regex, find_first=False):
"""
Gets all attachments by name for the mail.
:param name: The name of the attachment to look for.
:type name: str
:param check_regex: Checks the name for a regular expression.
:type check_regex: bo... | def get_attachments_by_name(self, name, check_regex, find_first=False):
"""
Gets all attachments by name for the mail.
:param name: The name of the attachment to look for.
:type name: str
:param check_regex: Checks the name for a regular expression.
:type check_regex: bo... | [
"Gets",
"all",
"attachments",
"by",
"name",
"for",
"the",
"mail",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/imap_hook.py#L236-L264 | [
"def",
"get_attachments_by_name",
"(",
"self",
",",
"name",
",",
"check_regex",
",",
"find_first",
"=",
"False",
")",
":",
"attachments",
"=",
"[",
"]",
"for",
"part",
"in",
"self",
".",
"mail",
".",
"walk",
"(",
")",
":",
"mail_part",
"=",
"MailPart",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | MailPart.get_file | Gets the file including name and payload.
:returns: the part's name and payload.
:rtype: tuple | airflow/contrib/hooks/imap_hook.py | def get_file(self):
"""
Gets the file including name and payload.
:returns: the part's name and payload.
:rtype: tuple
"""
return self.part.get_filename(), self.part.get_payload(decode=True) | def get_file(self):
"""
Gets the file including name and payload.
:returns: the part's name and payload.
:rtype: tuple
"""
return self.part.get_filename(), self.part.get_payload(decode=True) | [
"Gets",
"the",
"file",
"including",
"name",
"and",
"payload",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/imap_hook.py#L309-L316 | [
"def",
"get_file",
"(",
"self",
")",
":",
"return",
"self",
".",
"part",
".",
"get_filename",
"(",
")",
",",
"self",
".",
"part",
".",
"get_payload",
"(",
"decode",
"=",
"True",
")"
] | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AwsFirehoseHook.put_records | Write batch records to Kinesis Firehose | airflow/contrib/hooks/aws_firehose_hook.py | def put_records(self, records):
"""
Write batch records to Kinesis Firehose
"""
firehose_conn = self.get_conn()
response = firehose_conn.put_record_batch(
DeliveryStreamName=self.delivery_stream,
Records=records
)
return response | def put_records(self, records):
"""
Write batch records to Kinesis Firehose
"""
firehose_conn = self.get_conn()
response = firehose_conn.put_record_batch(
DeliveryStreamName=self.delivery_stream,
Records=records
)
return response | [
"Write",
"batch",
"records",
"to",
"Kinesis",
"Firehose"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/aws_firehose_hook.py#L44-L56 | [
"def",
"put_records",
"(",
"self",
",",
"records",
")",
":",
"firehose_conn",
"=",
"self",
".",
"get_conn",
"(",
")",
"response",
"=",
"firehose_conn",
".",
"put_record_batch",
"(",
"DeliveryStreamName",
"=",
"self",
".",
"delivery_stream",
",",
"Records",
"="... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | ReadyToRescheduleDep._get_dep_statuses | Determines whether a task is ready to be rescheduled. Only tasks in
NONE state with at least one row in task_reschedule table are
handled by this dependency class, otherwise this dependency is
considered as passed. This dependency fails if the latest reschedule
request's reschedule date ... | airflow/ti_deps/deps/ready_to_reschedule.py | def _get_dep_statuses(self, ti, session, dep_context):
"""
Determines whether a task is ready to be rescheduled. Only tasks in
NONE state with at least one row in task_reschedule table are
handled by this dependency class, otherwise this dependency is
considered as passed. This d... | def _get_dep_statuses(self, ti, session, dep_context):
"""
Determines whether a task is ready to be rescheduled. Only tasks in
NONE state with at least one row in task_reschedule table are
handled by this dependency class, otherwise this dependency is
considered as passed. This d... | [
"Determines",
"whether",
"a",
"task",
"is",
"ready",
"to",
"be",
"rescheduled",
".",
"Only",
"tasks",
"in",
"NONE",
"state",
"with",
"at",
"least",
"one",
"row",
"in",
"task_reschedule",
"table",
"are",
"handled",
"by",
"this",
"dependency",
"class",
"otherw... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/ti_deps/deps/ready_to_reschedule.py#L34-L69 | [
"def",
"_get_dep_statuses",
"(",
"self",
",",
"ti",
",",
"session",
",",
"dep_context",
")",
":",
"if",
"dep_context",
".",
"ignore_in_reschedule_period",
":",
"yield",
"self",
".",
"_passing_status",
"(",
"reason",
"=",
"\"The context specified that being in a resche... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | send_email | Send email using backend specified in EMAIL_BACKEND. | airflow/utils/email.py | def send_email(to, subject, html_content,
files=None, dryrun=False, cc=None, bcc=None,
mime_subtype='mixed', mime_charset='utf-8', **kwargs):
"""
Send email using backend specified in EMAIL_BACKEND.
"""
path, attr = configuration.conf.get('email', 'EMAIL_BACKEND').rsplit('.... | def send_email(to, subject, html_content,
files=None, dryrun=False, cc=None, bcc=None,
mime_subtype='mixed', mime_charset='utf-8', **kwargs):
"""
Send email using backend specified in EMAIL_BACKEND.
"""
path, attr = configuration.conf.get('email', 'EMAIL_BACKEND').rsplit('.... | [
"Send",
"email",
"using",
"backend",
"specified",
"in",
"EMAIL_BACKEND",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/email.py#L36-L50 | [
"def",
"send_email",
"(",
"to",
",",
"subject",
",",
"html_content",
",",
"files",
"=",
"None",
",",
"dryrun",
"=",
"False",
",",
"cc",
"=",
"None",
",",
"bcc",
"=",
"None",
",",
"mime_subtype",
"=",
"'mixed'",
",",
"mime_charset",
"=",
"'utf-8'",
",",... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | send_email_smtp | Send an email with html content
>>> send_email('test@example.com', 'foo', '<b>Foo</b> bar', ['/dev/null'], dryrun=True) | airflow/utils/email.py | def send_email_smtp(to, subject, html_content, files=None,
dryrun=False, cc=None, bcc=None,
mime_subtype='mixed', mime_charset='utf-8',
**kwargs):
"""
Send an email with html content
>>> send_email('test@example.com', 'foo', '<b>Foo</b> bar', ['/d... | def send_email_smtp(to, subject, html_content, files=None,
dryrun=False, cc=None, bcc=None,
mime_subtype='mixed', mime_charset='utf-8',
**kwargs):
"""
Send an email with html content
>>> send_email('test@example.com', 'foo', '<b>Foo</b> bar', ['/d... | [
"Send",
"an",
"email",
"with",
"html",
"content"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/email.py#L53-L96 | [
"def",
"send_email_smtp",
"(",
"to",
",",
"subject",
",",
"html_content",
",",
"files",
"=",
"None",
",",
"dryrun",
"=",
"False",
",",
"cc",
"=",
"None",
",",
"bcc",
"=",
"None",
",",
"mime_subtype",
"=",
"'mixed'",
",",
"mime_charset",
"=",
"'utf-8'",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | UtcDateTime.process_result_value | Processes DateTimes from the DB making sure it is always
returning UTC. Not using timezone.convert_to_utc as that
converts to configured TIMEZONE while the DB might be
running with some other setting. We assume UTC datetimes
in the database. | airflow/utils/sqlalchemy.py | def process_result_value(self, value, dialect):
"""
Processes DateTimes from the DB making sure it is always
returning UTC. Not using timezone.convert_to_utc as that
converts to configured TIMEZONE while the DB might be
running with some other setting. We assume UTC datetimes
... | def process_result_value(self, value, dialect):
"""
Processes DateTimes from the DB making sure it is always
returning UTC. Not using timezone.convert_to_utc as that
converts to configured TIMEZONE while the DB might be
running with some other setting. We assume UTC datetimes
... | [
"Processes",
"DateTimes",
"from",
"the",
"DB",
"making",
"sure",
"it",
"is",
"always",
"returning",
"UTC",
".",
"Not",
"using",
"timezone",
".",
"convert_to_utc",
"as",
"that",
"converts",
"to",
"configured",
"TIMEZONE",
"while",
"the",
"DB",
"might",
"be",
... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/sqlalchemy.py#L156-L170 | [
"def",
"process_result_value",
"(",
"self",
",",
"value",
",",
"dialect",
")",
":",
"if",
"value",
"is",
"not",
"None",
":",
"if",
"value",
".",
"tzinfo",
"is",
"None",
":",
"value",
"=",
"value",
".",
"replace",
"(",
"tzinfo",
"=",
"utc",
")",
"else... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | WasbHook.check_for_blob | Check if a blob exists on Azure Blob Storage.
:param container_name: Name of the container.
:type container_name: str
:param blob_name: Name of the blob.
:type blob_name: str
:param kwargs: Optional keyword arguments that
`BlockBlobService.exists()` takes.
:t... | airflow/contrib/hooks/wasb_hook.py | def check_for_blob(self, container_name, blob_name, **kwargs):
"""
Check if a blob exists on Azure Blob Storage.
:param container_name: Name of the container.
:type container_name: str
:param blob_name: Name of the blob.
:type blob_name: str
:param kwargs: Option... | def check_for_blob(self, container_name, blob_name, **kwargs):
"""
Check if a blob exists on Azure Blob Storage.
:param container_name: Name of the container.
:type container_name: str
:param blob_name: Name of the blob.
:type blob_name: str
:param kwargs: Option... | [
"Check",
"if",
"a",
"blob",
"exists",
"on",
"Azure",
"Blob",
"Storage",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/wasb_hook.py#L50-L64 | [
"def",
"check_for_blob",
"(",
"self",
",",
"container_name",
",",
"blob_name",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"connection",
".",
"exists",
"(",
"container_name",
",",
"blob_name",
",",
"*",
"*",
"kwargs",
")"
] | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | WasbHook.check_for_prefix | Check if a prefix exists on Azure Blob storage.
:param container_name: Name of the container.
:type container_name: str
:param prefix: Prefix of the blob.
:type prefix: str
:param kwargs: Optional keyword arguments that
`BlockBlobService.list_blobs()` takes.
... | airflow/contrib/hooks/wasb_hook.py | def check_for_prefix(self, container_name, prefix, **kwargs):
"""
Check if a prefix exists on Azure Blob storage.
:param container_name: Name of the container.
:type container_name: str
:param prefix: Prefix of the blob.
:type prefix: str
:param kwargs: Optional ... | def check_for_prefix(self, container_name, prefix, **kwargs):
"""
Check if a prefix exists on Azure Blob storage.
:param container_name: Name of the container.
:type container_name: str
:param prefix: Prefix of the blob.
:type prefix: str
:param kwargs: Optional ... | [
"Check",
"if",
"a",
"prefix",
"exists",
"on",
"Azure",
"Blob",
"storage",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/wasb_hook.py#L66-L82 | [
"def",
"check_for_prefix",
"(",
"self",
",",
"container_name",
",",
"prefix",
",",
"*",
"*",
"kwargs",
")",
":",
"matches",
"=",
"self",
".",
"connection",
".",
"list_blobs",
"(",
"container_name",
",",
"prefix",
",",
"num_results",
"=",
"1",
",",
"*",
"... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | WasbHook.load_file | Upload a file to Azure Blob Storage.
:param file_path: Path to the file to load.
:type file_path: str
:param container_name: Name of the container.
:type container_name: str
:param blob_name: Name of the blob.
:type blob_name: str
:param kwargs: Optional keyword ... | airflow/contrib/hooks/wasb_hook.py | def load_file(self, file_path, container_name, blob_name, **kwargs):
"""
Upload a file to Azure Blob Storage.
:param file_path: Path to the file to load.
:type file_path: str
:param container_name: Name of the container.
:type container_name: str
:param blob_name... | def load_file(self, file_path, container_name, blob_name, **kwargs):
"""
Upload a file to Azure Blob Storage.
:param file_path: Path to the file to load.
:type file_path: str
:param container_name: Name of the container.
:type container_name: str
:param blob_name... | [
"Upload",
"a",
"file",
"to",
"Azure",
"Blob",
"Storage",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/wasb_hook.py#L84-L100 | [
"def",
"load_file",
"(",
"self",
",",
"file_path",
",",
"container_name",
",",
"blob_name",
",",
"*",
"*",
"kwargs",
")",
":",
"# Reorder the argument order from airflow.hooks.S3_hook.load_file.",
"self",
".",
"connection",
".",
"create_blob_from_path",
"(",
"container_... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | WasbHook.load_string | Upload a string to Azure Blob Storage.
:param string_data: String to load.
:type string_data: str
:param container_name: Name of the container.
:type container_name: str
:param blob_name: Name of the blob.
:type blob_name: str
:param kwargs: Optional keyword argu... | airflow/contrib/hooks/wasb_hook.py | def load_string(self, string_data, container_name, blob_name, **kwargs):
"""
Upload a string to Azure Blob Storage.
:param string_data: String to load.
:type string_data: str
:param container_name: Name of the container.
:type container_name: str
:param blob_name... | def load_string(self, string_data, container_name, blob_name, **kwargs):
"""
Upload a string to Azure Blob Storage.
:param string_data: String to load.
:type string_data: str
:param container_name: Name of the container.
:type container_name: str
:param blob_name... | [
"Upload",
"a",
"string",
"to",
"Azure",
"Blob",
"Storage",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/wasb_hook.py#L102-L118 | [
"def",
"load_string",
"(",
"self",
",",
"string_data",
",",
"container_name",
",",
"blob_name",
",",
"*",
"*",
"kwargs",
")",
":",
"# Reorder the argument order from airflow.hooks.S3_hook.load_string.",
"self",
".",
"connection",
".",
"create_blob_from_text",
"(",
"cont... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | WasbHook.get_file | Download a file from Azure Blob Storage.
:param file_path: Path to the file to download.
:type file_path: str
:param container_name: Name of the container.
:type container_name: str
:param blob_name: Name of the blob.
:type blob_name: str
:param kwargs: Optional ... | airflow/contrib/hooks/wasb_hook.py | def get_file(self, file_path, container_name, blob_name, **kwargs):
"""
Download a file from Azure Blob Storage.
:param file_path: Path to the file to download.
:type file_path: str
:param container_name: Name of the container.
:type container_name: str
:param bl... | def get_file(self, file_path, container_name, blob_name, **kwargs):
"""
Download a file from Azure Blob Storage.
:param file_path: Path to the file to download.
:type file_path: str
:param container_name: Name of the container.
:type container_name: str
:param bl... | [
"Download",
"a",
"file",
"from",
"Azure",
"Blob",
"Storage",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/wasb_hook.py#L120-L135 | [
"def",
"get_file",
"(",
"self",
",",
"file_path",
",",
"container_name",
",",
"blob_name",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"connection",
".",
"get_blob_to_path",
"(",
"container_name",
",",
"blob_name",
",",
"file_path",
",",
"*",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | WasbHook.read_file | Read a file from Azure Blob Storage and return as a string.
:param container_name: Name of the container.
:type container_name: str
:param blob_name: Name of the blob.
:type blob_name: str
:param kwargs: Optional keyword arguments that
`BlockBlobService.create_blob_f... | airflow/contrib/hooks/wasb_hook.py | def read_file(self, container_name, blob_name, **kwargs):
"""
Read a file from Azure Blob Storage and return as a string.
:param container_name: Name of the container.
:type container_name: str
:param blob_name: Name of the blob.
:type blob_name: str
:param kwarg... | def read_file(self, container_name, blob_name, **kwargs):
"""
Read a file from Azure Blob Storage and return as a string.
:param container_name: Name of the container.
:type container_name: str
:param blob_name: Name of the blob.
:type blob_name: str
:param kwarg... | [
"Read",
"a",
"file",
"from",
"Azure",
"Blob",
"Storage",
"and",
"return",
"as",
"a",
"string",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/wasb_hook.py#L137-L151 | [
"def",
"read_file",
"(",
"self",
",",
"container_name",
",",
"blob_name",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"connection",
".",
"get_blob_to_text",
"(",
"container_name",
",",
"blob_name",
",",
"*",
"*",
"kwargs",
")",
".",
"content"... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | WasbHook.delete_file | Delete a file from Azure Blob Storage.
:param container_name: Name of the container.
:type container_name: str
:param blob_name: Name of the blob.
:type blob_name: str
:param is_prefix: If blob_name is a prefix, delete all matching files
:type is_prefix: bool
:pa... | airflow/contrib/hooks/wasb_hook.py | def delete_file(self, container_name, blob_name, is_prefix=False,
ignore_if_missing=False, **kwargs):
"""
Delete a file from Azure Blob Storage.
:param container_name: Name of the container.
:type container_name: str
:param blob_name: Name of the blob.
... | def delete_file(self, container_name, blob_name, is_prefix=False,
ignore_if_missing=False, **kwargs):
"""
Delete a file from Azure Blob Storage.
:param container_name: Name of the container.
:type container_name: str
:param blob_name: Name of the blob.
... | [
"Delete",
"a",
"file",
"from",
"Azure",
"Blob",
"Storage",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/wasb_hook.py#L153-L191 | [
"def",
"delete_file",
"(",
"self",
",",
"container_name",
",",
"blob_name",
",",
"is_prefix",
"=",
"False",
",",
"ignore_if_missing",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"is_prefix",
":",
"blobs_to_delete",
"=",
"[",
"blob",
".",
"name",... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | mlsd | BACKPORT FROM PYTHON3 FTPLIB.
List a directory in a standardized format by using MLSD
command (RFC-3659). If path is omitted the current directory
is assumed. "facts" is a list of strings representing the type
of information desired (e.g. ["type", "size", "perm"]).
Return a generator object yieldi... | airflow/contrib/hooks/ftp_hook.py | def mlsd(conn, path="", facts=None):
"""
BACKPORT FROM PYTHON3 FTPLIB.
List a directory in a standardized format by using MLSD
command (RFC-3659). If path is omitted the current directory
is assumed. "facts" is a list of strings representing the type
of information desired (e.g. ["type", "size"... | def mlsd(conn, path="", facts=None):
"""
BACKPORT FROM PYTHON3 FTPLIB.
List a directory in a standardized format by using MLSD
command (RFC-3659). If path is omitted the current directory
is assumed. "facts" is a list of strings representing the type
of information desired (e.g. ["type", "size"... | [
"BACKPORT",
"FROM",
"PYTHON3",
"FTPLIB",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/ftp_hook.py#L28-L58 | [
"def",
"mlsd",
"(",
"conn",
",",
"path",
"=",
"\"\"",
",",
"facts",
"=",
"None",
")",
":",
"facts",
"=",
"facts",
"or",
"[",
"]",
"if",
"facts",
":",
"conn",
".",
"sendcmd",
"(",
"\"OPTS MLST \"",
"+",
"\";\"",
".",
"join",
"(",
"facts",
")",
"+"... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | FTPHook.get_conn | Returns a FTP connection object | airflow/contrib/hooks/ftp_hook.py | def get_conn(self):
"""
Returns a FTP connection object
"""
if self.conn is None:
params = self.get_connection(self.ftp_conn_id)
pasv = params.extra_dejson.get("passive", True)
self.conn = ftplib.FTP(params.host, params.login, params.password)
... | def get_conn(self):
"""
Returns a FTP connection object
"""
if self.conn is None:
params = self.get_connection(self.ftp_conn_id)
pasv = params.extra_dejson.get("passive", True)
self.conn = ftplib.FTP(params.host, params.login, params.password)
... | [
"Returns",
"a",
"FTP",
"connection",
"object"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/ftp_hook.py#L81-L91 | [
"def",
"get_conn",
"(",
"self",
")",
":",
"if",
"self",
".",
"conn",
"is",
"None",
":",
"params",
"=",
"self",
".",
"get_connection",
"(",
"self",
".",
"ftp_conn_id",
")",
"pasv",
"=",
"params",
".",
"extra_dejson",
".",
"get",
"(",
"\"passive\"",
",",... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | FTPHook.describe_directory | Returns a dictionary of {filename: {attributes}} for all files
on the remote system (where the MLSD command is supported).
:param path: full path to the remote directory
:type path: str | airflow/contrib/hooks/ftp_hook.py | def describe_directory(self, path):
"""
Returns a dictionary of {filename: {attributes}} for all files
on the remote system (where the MLSD command is supported).
:param path: full path to the remote directory
:type path: str
"""
conn = self.get_conn()
co... | def describe_directory(self, path):
"""
Returns a dictionary of {filename: {attributes}} for all files
on the remote system (where the MLSD command is supported).
:param path: full path to the remote directory
:type path: str
"""
conn = self.get_conn()
co... | [
"Returns",
"a",
"dictionary",
"of",
"{",
"filename",
":",
"{",
"attributes",
"}}",
"for",
"all",
"files",
"on",
"the",
"remote",
"system",
"(",
"where",
"the",
"MLSD",
"command",
"is",
"supported",
")",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/ftp_hook.py#L102-L117 | [
"def",
"describe_directory",
"(",
"self",
",",
"path",
")",
":",
"conn",
"=",
"self",
".",
"get_conn",
"(",
")",
"conn",
".",
"cwd",
"(",
"path",
")",
"try",
":",
"# only works in Python 3",
"files",
"=",
"dict",
"(",
"conn",
".",
"mlsd",
"(",
")",
"... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | FTPHook.list_directory | Returns a list of files on the remote system.
:param path: full path to the remote directory to list
:type path: str | airflow/contrib/hooks/ftp_hook.py | def list_directory(self, path, nlst=False):
"""
Returns a list of files on the remote system.
:param path: full path to the remote directory to list
:type path: str
"""
conn = self.get_conn()
conn.cwd(path)
files = conn.nlst()
return files | def list_directory(self, path, nlst=False):
"""
Returns a list of files on the remote system.
:param path: full path to the remote directory to list
:type path: str
"""
conn = self.get_conn()
conn.cwd(path)
files = conn.nlst()
return files | [
"Returns",
"a",
"list",
"of",
"files",
"on",
"the",
"remote",
"system",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/ftp_hook.py#L119-L130 | [
"def",
"list_directory",
"(",
"self",
",",
"path",
",",
"nlst",
"=",
"False",
")",
":",
"conn",
"=",
"self",
".",
"get_conn",
"(",
")",
"conn",
".",
"cwd",
"(",
"path",
")",
"files",
"=",
"conn",
".",
"nlst",
"(",
")",
"return",
"files"
] | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | FTPHook.retrieve_file | Transfers the remote file to a local location.
If local_full_path_or_buffer is a string path, the file will be put
at that location; if it is a file-like buffer, the file will
be written to the buffer but not closed.
:param remote_full_path: full path to the remote file
:type r... | airflow/contrib/hooks/ftp_hook.py | def retrieve_file(
self,
remote_full_path,
local_full_path_or_buffer,
callback=None):
"""
Transfers the remote file to a local location.
If local_full_path_or_buffer is a string path, the file will be put
at that location; if it is a file-... | def retrieve_file(
self,
remote_full_path,
local_full_path_or_buffer,
callback=None):
"""
Transfers the remote file to a local location.
If local_full_path_or_buffer is a string path, the file will be put
at that location; if it is a file-... | [
"Transfers",
"the",
"remote",
"file",
"to",
"a",
"local",
"location",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/ftp_hook.py#L152-L223 | [
"def",
"retrieve_file",
"(",
"self",
",",
"remote_full_path",
",",
"local_full_path_or_buffer",
",",
"callback",
"=",
"None",
")",
":",
"conn",
"=",
"self",
".",
"get_conn",
"(",
")",
"is_path",
"=",
"isinstance",
"(",
"local_full_path_or_buffer",
",",
"basestri... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | FTPHook.store_file | Transfers a local file to the remote location.
If local_full_path_or_buffer is a string path, the file will be read
from that location; if it is a file-like buffer, the file will
be read from the buffer but not closed.
:param remote_full_path: full path to the remote file
:type... | airflow/contrib/hooks/ftp_hook.py | def store_file(self, remote_full_path, local_full_path_or_buffer):
"""
Transfers a local file to the remote location.
If local_full_path_or_buffer is a string path, the file will be read
from that location; if it is a file-like buffer, the file will
be read from the buffer but n... | def store_file(self, remote_full_path, local_full_path_or_buffer):
"""
Transfers a local file to the remote location.
If local_full_path_or_buffer is a string path, the file will be read
from that location; if it is a file-like buffer, the file will
be read from the buffer but n... | [
"Transfers",
"a",
"local",
"file",
"to",
"the",
"remote",
"location",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/ftp_hook.py#L225-L252 | [
"def",
"store_file",
"(",
"self",
",",
"remote_full_path",
",",
"local_full_path_or_buffer",
")",
":",
"conn",
"=",
"self",
".",
"get_conn",
"(",
")",
"is_path",
"=",
"isinstance",
"(",
"local_full_path_or_buffer",
",",
"basestring",
")",
"if",
"is_path",
":",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | FTPHook.rename | Rename a file.
:param from_name: rename file from name
:param to_name: rename file to name | airflow/contrib/hooks/ftp_hook.py | def rename(self, from_name, to_name):
"""
Rename a file.
:param from_name: rename file from name
:param to_name: rename file to name
"""
conn = self.get_conn()
return conn.rename(from_name, to_name) | def rename(self, from_name, to_name):
"""
Rename a file.
:param from_name: rename file from name
:param to_name: rename file to name
"""
conn = self.get_conn()
return conn.rename(from_name, to_name) | [
"Rename",
"a",
"file",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/ftp_hook.py#L264-L272 | [
"def",
"rename",
"(",
"self",
",",
"from_name",
",",
"to_name",
")",
":",
"conn",
"=",
"self",
".",
"get_conn",
"(",
")",
"return",
"conn",
".",
"rename",
"(",
"from_name",
",",
"to_name",
")"
] | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | FTPHook.get_mod_time | Returns a datetime object representing the last time the file was modified
:param path: remote file path
:type path: string | airflow/contrib/hooks/ftp_hook.py | def get_mod_time(self, path):
"""
Returns a datetime object representing the last time the file was modified
:param path: remote file path
:type path: string
"""
conn = self.get_conn()
ftp_mdtm = conn.sendcmd('MDTM ' + path)
time_val = ftp_mdtm[4:]
... | def get_mod_time(self, path):
"""
Returns a datetime object representing the last time the file was modified
:param path: remote file path
:type path: string
"""
conn = self.get_conn()
ftp_mdtm = conn.sendcmd('MDTM ' + path)
time_val = ftp_mdtm[4:]
... | [
"Returns",
"a",
"datetime",
"object",
"representing",
"the",
"last",
"time",
"the",
"file",
"was",
"modified"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/ftp_hook.py#L274-L288 | [
"def",
"get_mod_time",
"(",
"self",
",",
"path",
")",
":",
"conn",
"=",
"self",
".",
"get_conn",
"(",
")",
"ftp_mdtm",
"=",
"conn",
".",
"sendcmd",
"(",
"'MDTM '",
"+",
"path",
")",
"time_val",
"=",
"ftp_mdtm",
"[",
"4",
":",
"]",
"# time_val optionall... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | _create_dagruns | Infers from the dates which dag runs need to be created and does so.
:param dag: the dag to create dag runs for
:param execution_dates: list of execution dates to evaluate
:param state: the state to set the dag run to
:param run_id_template:the template for run id to be with the execution date
:retu... | airflow/api/common/experimental/mark_tasks.py | def _create_dagruns(dag, execution_dates, state, run_id_template):
"""
Infers from the dates which dag runs need to be created and does so.
:param dag: the dag to create dag runs for
:param execution_dates: list of execution dates to evaluate
:param state: the state to set the dag run to
:param ... | def _create_dagruns(dag, execution_dates, state, run_id_template):
"""
Infers from the dates which dag runs need to be created and does so.
:param dag: the dag to create dag runs for
:param execution_dates: list of execution dates to evaluate
:param state: the state to set the dag run to
:param ... | [
"Infers",
"from",
"the",
"dates",
"which",
"dag",
"runs",
"need",
"to",
"be",
"created",
"and",
"does",
"so",
".",
":",
"param",
"dag",
":",
"the",
"dag",
"to",
"create",
"dag",
"runs",
"for",
":",
"param",
"execution_dates",
":",
"list",
"of",
"execut... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/api/common/experimental/mark_tasks.py#L30-L53 | [
"def",
"_create_dagruns",
"(",
"dag",
",",
"execution_dates",
",",
"state",
",",
"run_id_template",
")",
":",
"# find out if we need to create any dag runs",
"drs",
"=",
"DagRun",
".",
"find",
"(",
"dag_id",
"=",
"dag",
".",
"dag_id",
",",
"execution_date",
"=",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | set_state | Set the state of a task instance and if needed its relatives. Can set state
for future tasks (calculated from execution_date) and retroactively
for past tasks. Will verify integrity of past dag runs in order to create
tasks that did not exist. It will not create dag runs that are missing
on the schedule... | airflow/api/common/experimental/mark_tasks.py | def set_state(task, execution_date, upstream=False, downstream=False,
future=False, past=False, state=State.SUCCESS, commit=False, session=None):
"""
Set the state of a task instance and if needed its relatives. Can set state
for future tasks (calculated from execution_date) and retroactively
... | def set_state(task, execution_date, upstream=False, downstream=False,
future=False, past=False, state=State.SUCCESS, commit=False, session=None):
"""
Set the state of a task instance and if needed its relatives. Can set state
for future tasks (calculated from execution_date) and retroactively
... | [
"Set",
"the",
"state",
"of",
"a",
"task",
"instance",
"and",
"if",
"needed",
"its",
"relatives",
".",
"Can",
"set",
"state",
"for",
"future",
"tasks",
"(",
"calculated",
"from",
"execution_date",
")",
"and",
"retroactively",
"for",
"past",
"tasks",
".",
"W... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/api/common/experimental/mark_tasks.py#L57-L184 | [
"def",
"set_state",
"(",
"task",
",",
"execution_date",
",",
"upstream",
"=",
"False",
",",
"downstream",
"=",
"False",
",",
"future",
"=",
"False",
",",
"past",
"=",
"False",
",",
"state",
"=",
"State",
".",
"SUCCESS",
",",
"commit",
"=",
"False",
","... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | _set_dag_run_state | Helper method that set dag run state in the DB.
:param dag_id: dag_id of target dag run
:param execution_date: the execution date from which to start looking
:param state: target state
:param session: database session | airflow/api/common/experimental/mark_tasks.py | def _set_dag_run_state(dag_id, execution_date, state, session=None):
"""
Helper method that set dag run state in the DB.
:param dag_id: dag_id of target dag run
:param execution_date: the execution date from which to start looking
:param state: target state
:param session: database session
"... | def _set_dag_run_state(dag_id, execution_date, state, session=None):
"""
Helper method that set dag run state in the DB.
:param dag_id: dag_id of target dag run
:param execution_date: the execution date from which to start looking
:param state: target state
:param session: database session
"... | [
"Helper",
"method",
"that",
"set",
"dag",
"run",
"state",
"in",
"the",
"DB",
".",
":",
"param",
"dag_id",
":",
"dag_id",
"of",
"target",
"dag",
"run",
":",
"param",
"execution_date",
":",
"the",
"execution",
"date",
"from",
"which",
"to",
"start",
"looki... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/api/common/experimental/mark_tasks.py#L188-L207 | [
"def",
"_set_dag_run_state",
"(",
"dag_id",
",",
"execution_date",
",",
"state",
",",
"session",
"=",
"None",
")",
":",
"DR",
"=",
"DagRun",
"dr",
"=",
"session",
".",
"query",
"(",
"DR",
")",
".",
"filter",
"(",
"DR",
".",
"dag_id",
"==",
"dag_id",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | set_dag_run_state_to_success | Set the dag run for a specific execution date and its task instances
to success.
:param dag: the DAG of which to alter state
:param execution_date: the execution date from which to start looking
:param commit: commit DAG and tasks to be altered to the database
:param session: database session
:r... | airflow/api/common/experimental/mark_tasks.py | def set_dag_run_state_to_success(dag, execution_date, commit=False, session=None):
"""
Set the dag run for a specific execution date and its task instances
to success.
:param dag: the DAG of which to alter state
:param execution_date: the execution date from which to start looking
:param commit:... | def set_dag_run_state_to_success(dag, execution_date, commit=False, session=None):
"""
Set the dag run for a specific execution date and its task instances
to success.
:param dag: the DAG of which to alter state
:param execution_date: the execution date from which to start looking
:param commit:... | [
"Set",
"the",
"dag",
"run",
"for",
"a",
"specific",
"execution",
"date",
"and",
"its",
"task",
"instances",
"to",
"success",
".",
":",
"param",
"dag",
":",
"the",
"DAG",
"of",
"which",
"to",
"alter",
"state",
":",
"param",
"execution_date",
":",
"the",
... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/api/common/experimental/mark_tasks.py#L211-L239 | [
"def",
"set_dag_run_state_to_success",
"(",
"dag",
",",
"execution_date",
",",
"commit",
"=",
"False",
",",
"session",
"=",
"None",
")",
":",
"res",
"=",
"[",
"]",
"if",
"not",
"dag",
"or",
"not",
"execution_date",
":",
"return",
"res",
"# Mark the dag run t... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | set_dag_run_state_to_failed | Set the dag run for a specific execution date and its running task instances
to failed.
:param dag: the DAG of which to alter state
:param execution_date: the execution date from which to start looking
:param commit: commit DAG and tasks to be altered to the database
:param session: database session... | airflow/api/common/experimental/mark_tasks.py | def set_dag_run_state_to_failed(dag, execution_date, commit=False, session=None):
"""
Set the dag run for a specific execution date and its running task instances
to failed.
:param dag: the DAG of which to alter state
:param execution_date: the execution date from which to start looking
:param c... | def set_dag_run_state_to_failed(dag, execution_date, commit=False, session=None):
"""
Set the dag run for a specific execution date and its running task instances
to failed.
:param dag: the DAG of which to alter state
:param execution_date: the execution date from which to start looking
:param c... | [
"Set",
"the",
"dag",
"run",
"for",
"a",
"specific",
"execution",
"date",
"and",
"its",
"running",
"task",
"instances",
"to",
"failed",
".",
":",
"param",
"dag",
":",
"the",
"DAG",
"of",
"which",
"to",
"alter",
"state",
":",
"param",
"execution_date",
":"... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/api/common/experimental/mark_tasks.py#L243-L280 | [
"def",
"set_dag_run_state_to_failed",
"(",
"dag",
",",
"execution_date",
",",
"commit",
"=",
"False",
",",
"session",
"=",
"None",
")",
":",
"res",
"=",
"[",
"]",
"if",
"not",
"dag",
"or",
"not",
"execution_date",
":",
"return",
"res",
"# Mark the dag run to... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | set_dag_run_state_to_running | Set the dag run for a specific execution date to running.
:param dag: the DAG of which to alter state
:param execution_date: the execution date from which to start looking
:param commit: commit DAG and tasks to be altered to the database
:param session: database session
:return: If commit is true, l... | airflow/api/common/experimental/mark_tasks.py | def set_dag_run_state_to_running(dag, execution_date, commit=False, session=None):
"""
Set the dag run for a specific execution date to running.
:param dag: the DAG of which to alter state
:param execution_date: the execution date from which to start looking
:param commit: commit DAG and tasks to be... | def set_dag_run_state_to_running(dag, execution_date, commit=False, session=None):
"""
Set the dag run for a specific execution date to running.
:param dag: the DAG of which to alter state
:param execution_date: the execution date from which to start looking
:param commit: commit DAG and tasks to be... | [
"Set",
"the",
"dag",
"run",
"for",
"a",
"specific",
"execution",
"date",
"to",
"running",
".",
":",
"param",
"dag",
":",
"the",
"DAG",
"of",
"which",
"to",
"alter",
"state",
":",
"param",
"execution_date",
":",
"the",
"execution",
"date",
"from",
"which"... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/api/common/experimental/mark_tasks.py#L284-L303 | [
"def",
"set_dag_run_state_to_running",
"(",
"dag",
",",
"execution_date",
",",
"commit",
"=",
"False",
",",
"session",
"=",
"None",
")",
":",
"res",
"=",
"[",
"]",
"if",
"not",
"dag",
"or",
"not",
"execution_date",
":",
"return",
"res",
"# Mark the dag run t... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | git_version | Return a version to identify the state of the underlying git repo. The version will
indicate whether the head of the current git-backed working directory is tied to a
release tag or not : it will indicate the former with a 'release:{version}' prefix
and the latter with a 'dev0' prefix. Following the prefix ... | setup.py | def git_version(version):
"""
Return a version to identify the state of the underlying git repo. The version will
indicate whether the head of the current git-backed working directory is tied to a
release tag or not : it will indicate the former with a 'release:{version}' prefix
and the latter with ... | def git_version(version):
"""
Return a version to identify the state of the underlying git repo. The version will
indicate whether the head of the current git-backed working directory is tied to a
release tag or not : it will indicate the former with a 'release:{version}' prefix
and the latter with ... | [
"Return",
"a",
"version",
"to",
"identify",
"the",
"state",
"of",
"the",
"underlying",
"git",
"repo",
".",
"The",
"version",
"will",
"indicate",
"whether",
"the",
"head",
"of",
"the",
"current",
"git",
"-",
"backed",
"working",
"directory",
"is",
"tied",
"... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/setup.py#L102-L128 | [
"def",
"git_version",
"(",
"version",
")",
":",
"repo",
"=",
"None",
"try",
":",
"import",
"git",
"repo",
"=",
"git",
".",
"Repo",
"(",
"'.git'",
")",
"except",
"ImportError",
":",
"logger",
".",
"warning",
"(",
"'gitpython not found: Cannot compute the git ve... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | DiscordWebhookOperator.execute | Call the DiscordWebhookHook to post message | airflow/contrib/operators/discord_webhook_operator.py | def execute(self, context):
"""
Call the DiscordWebhookHook to post message
"""
self.hook = DiscordWebhookHook(
self.http_conn_id,
self.webhook_endpoint,
self.message,
self.username,
self.avatar_url,
self.tts,
... | def execute(self, context):
"""
Call the DiscordWebhookHook to post message
"""
self.hook = DiscordWebhookHook(
self.http_conn_id,
self.webhook_endpoint,
self.message,
self.username,
self.avatar_url,
self.tts,
... | [
"Call",
"the",
"DiscordWebhookHook",
"to",
"post",
"message"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/operators/discord_webhook_operator.py#L85-L98 | [
"def",
"execute",
"(",
"self",
",",
"context",
")",
":",
"self",
".",
"hook",
"=",
"DiscordWebhookHook",
"(",
"self",
".",
"http_conn_id",
",",
"self",
".",
"webhook_endpoint",
",",
"self",
".",
"message",
",",
"self",
".",
"username",
",",
"self",
".",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | GcpBodyFieldValidator._validate_field | Validates if field is OK.
:param validation_spec: specification of the field
:type validation_spec: dict
:param dictionary_to_validate: dictionary where the field should be present
:type dictionary_to_validate: dict
:param parent: full path of parent field
:type parent: ... | airflow/contrib/utils/gcp_field_validator.py | def _validate_field(self, validation_spec, dictionary_to_validate, parent=None,
force_optional=False):
"""
Validates if field is OK.
:param validation_spec: specification of the field
:type validation_spec: dict
:param dictionary_to_validate: dictionary w... | def _validate_field(self, validation_spec, dictionary_to_validate, parent=None,
force_optional=False):
"""
Validates if field is OK.
:param validation_spec: specification of the field
:type validation_spec: dict
:param dictionary_to_validate: dictionary w... | [
"Validates",
"if",
"field",
"is",
"OK",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/utils/gcp_field_validator.py#L308-L404 | [
"def",
"_validate_field",
"(",
"self",
",",
"validation_spec",
",",
"dictionary_to_validate",
",",
"parent",
"=",
"None",
",",
"force_optional",
"=",
"False",
")",
":",
"field_name",
"=",
"validation_spec",
"[",
"'name'",
"]",
"field_type",
"=",
"validation_spec",... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | GcpBodyFieldValidator.validate | Validates if the body (dictionary) follows specification that the validator was
instantiated with. Raises ValidationSpecificationException or
ValidationFieldException in case of problems with specification or the
body not conforming to the specification respectively.
:param body_to_vali... | airflow/contrib/utils/gcp_field_validator.py | def validate(self, body_to_validate):
"""
Validates if the body (dictionary) follows specification that the validator was
instantiated with. Raises ValidationSpecificationException or
ValidationFieldException in case of problems with specification or the
body not conforming to th... | def validate(self, body_to_validate):
"""
Validates if the body (dictionary) follows specification that the validator was
instantiated with. Raises ValidationSpecificationException or
ValidationFieldException in case of problems with specification or the
body not conforming to th... | [
"Validates",
"if",
"the",
"body",
"(",
"dictionary",
")",
"follows",
"specification",
"that",
"the",
"validator",
"was",
"instantiated",
"with",
".",
"Raises",
"ValidationSpecificationException",
"or",
"ValidationFieldException",
"in",
"case",
"of",
"problems",
"with"... | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/utils/gcp_field_validator.py#L406-L444 | [
"def",
"validate",
"(",
"self",
",",
"body_to_validate",
")",
":",
"try",
":",
"for",
"validation_spec",
"in",
"self",
".",
"_validation_specs",
":",
"self",
".",
"_validate_field",
"(",
"validation_spec",
"=",
"validation_spec",
",",
"dictionary_to_validate",
"="... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureFileShareHook.get_conn | Return the FileService object. | airflow/contrib/hooks/azure_fileshare_hook.py | def get_conn(self):
"""Return the FileService object."""
conn = self.get_connection(self.conn_id)
service_options = conn.extra_dejson
return FileService(account_name=conn.login,
account_key=conn.password, **service_options) | def get_conn(self):
"""Return the FileService object."""
conn = self.get_connection(self.conn_id)
service_options = conn.extra_dejson
return FileService(account_name=conn.login,
account_key=conn.password, **service_options) | [
"Return",
"the",
"FileService",
"object",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_fileshare_hook.py#L40-L45 | [
"def",
"get_conn",
"(",
"self",
")",
":",
"conn",
"=",
"self",
".",
"get_connection",
"(",
"self",
".",
"conn_id",
")",
"service_options",
"=",
"conn",
".",
"extra_dejson",
"return",
"FileService",
"(",
"account_name",
"=",
"conn",
".",
"login",
",",
"acco... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureFileShareHook.check_for_directory | Check if a directory exists on Azure File Share.
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param kwargs: Optional keyword arguments that
`FileService.exists()` takes.
:... | airflow/contrib/hooks/azure_fileshare_hook.py | def check_for_directory(self, share_name, directory_name, **kwargs):
"""
Check if a directory exists on Azure File Share.
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param kw... | def check_for_directory(self, share_name, directory_name, **kwargs):
"""
Check if a directory exists on Azure File Share.
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param kw... | [
"Check",
"if",
"a",
"directory",
"exists",
"on",
"Azure",
"File",
"Share",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_fileshare_hook.py#L47-L62 | [
"def",
"check_for_directory",
"(",
"self",
",",
"share_name",
",",
"directory_name",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"connection",
".",
"exists",
"(",
"share_name",
",",
"directory_name",
",",
"*",
"*",
"kwargs",
")"
] | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureFileShareHook.check_for_file | Check if a file exists on Azure File Share.
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param file_name: Name of the file.
:type file_name: str
:param kwargs: Optional keywor... | airflow/contrib/hooks/azure_fileshare_hook.py | def check_for_file(self, share_name, directory_name, file_name, **kwargs):
"""
Check if a file exists on Azure File Share.
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param f... | def check_for_file(self, share_name, directory_name, file_name, **kwargs):
"""
Check if a file exists on Azure File Share.
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param f... | [
"Check",
"if",
"a",
"file",
"exists",
"on",
"Azure",
"File",
"Share",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_fileshare_hook.py#L64-L81 | [
"def",
"check_for_file",
"(",
"self",
",",
"share_name",
",",
"directory_name",
",",
"file_name",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"connection",
".",
"exists",
"(",
"share_name",
",",
"directory_name",
",",
"file_name",
",",
"*",
"... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureFileShareHook.list_directories_and_files | Return the list of directories and files stored on a Azure File Share.
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param kwargs: Optional keyword arguments that
`FileService.list... | airflow/contrib/hooks/azure_fileshare_hook.py | def list_directories_and_files(self, share_name, directory_name=None, **kwargs):
"""
Return the list of directories and files stored on a Azure File Share.
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type dir... | def list_directories_and_files(self, share_name, directory_name=None, **kwargs):
"""
Return the list of directories and files stored on a Azure File Share.
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type dir... | [
"Return",
"the",
"list",
"of",
"directories",
"and",
"files",
"stored",
"on",
"a",
"Azure",
"File",
"Share",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_fileshare_hook.py#L83-L99 | [
"def",
"list_directories_and_files",
"(",
"self",
",",
"share_name",
",",
"directory_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"connection",
".",
"list_directories_and_files",
"(",
"share_name",
",",
"directory_name",
",",
"*"... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureFileShareHook.create_directory | Create a new directory on a Azure File Share.
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param kwargs: Optional keyword arguments that
`FileService.create_directory()` takes.
... | airflow/contrib/hooks/azure_fileshare_hook.py | def create_directory(self, share_name, directory_name, **kwargs):
"""
Create a new directory on a Azure File Share.
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param kwargs: ... | def create_directory(self, share_name, directory_name, **kwargs):
"""
Create a new directory on a Azure File Share.
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param kwargs: ... | [
"Create",
"a",
"new",
"directory",
"on",
"a",
"Azure",
"File",
"Share",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_fileshare_hook.py#L101-L115 | [
"def",
"create_directory",
"(",
"self",
",",
"share_name",
",",
"directory_name",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"connection",
".",
"create_directory",
"(",
"share_name",
",",
"directory_name",
",",
"*",
"*",
"kwargs",
")"
] | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureFileShareHook.get_file | Download a file from Azure File Share.
:param file_path: Where to store the file.
:type file_path: str
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param file_name: Name of th... | airflow/contrib/hooks/azure_fileshare_hook.py | def get_file(self, file_path, share_name, directory_name, file_name, **kwargs):
"""
Download a file from Azure File Share.
:param file_path: Where to store the file.
:type file_path: str
:param share_name: Name of the share.
:type share_name: str
:param directory... | def get_file(self, file_path, share_name, directory_name, file_name, **kwargs):
"""
Download a file from Azure File Share.
:param file_path: Where to store the file.
:type file_path: str
:param share_name: Name of the share.
:type share_name: str
:param directory... | [
"Download",
"a",
"file",
"from",
"Azure",
"File",
"Share",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_fileshare_hook.py#L117-L134 | [
"def",
"get_file",
"(",
"self",
",",
"file_path",
",",
"share_name",
",",
"directory_name",
",",
"file_name",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"connection",
".",
"get_file_to_path",
"(",
"share_name",
",",
"directory_name",
",",
"file_name",
"... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureFileShareHook.get_file_to_stream | Download a file from Azure File Share.
:param stream: A filehandle to store the file to.
:type stream: file-like object
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param file... | airflow/contrib/hooks/azure_fileshare_hook.py | def get_file_to_stream(self, stream, share_name, directory_name, file_name, **kwargs):
"""
Download a file from Azure File Share.
:param stream: A filehandle to store the file to.
:type stream: file-like object
:param share_name: Name of the share.
:type share_name: str
... | def get_file_to_stream(self, stream, share_name, directory_name, file_name, **kwargs):
"""
Download a file from Azure File Share.
:param stream: A filehandle to store the file to.
:type stream: file-like object
:param share_name: Name of the share.
:type share_name: str
... | [
"Download",
"a",
"file",
"from",
"Azure",
"File",
"Share",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_fileshare_hook.py#L136-L153 | [
"def",
"get_file_to_stream",
"(",
"self",
",",
"stream",
",",
"share_name",
",",
"directory_name",
",",
"file_name",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"connection",
".",
"get_file_to_stream",
"(",
"share_name",
",",
"directory_name",
",",
"file_n... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureFileShareHook.load_file | Upload a file to Azure File Share.
:param file_path: Path to the file to load.
:type file_path: str
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param file_name: Name of the f... | airflow/contrib/hooks/azure_fileshare_hook.py | def load_file(self, file_path, share_name, directory_name, file_name, **kwargs):
"""
Upload a file to Azure File Share.
:param file_path: Path to the file to load.
:type file_path: str
:param share_name: Name of the share.
:type share_name: str
:param directory_n... | def load_file(self, file_path, share_name, directory_name, file_name, **kwargs):
"""
Upload a file to Azure File Share.
:param file_path: Path to the file to load.
:type file_path: str
:param share_name: Name of the share.
:type share_name: str
:param directory_n... | [
"Upload",
"a",
"file",
"to",
"Azure",
"File",
"Share",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_fileshare_hook.py#L155-L172 | [
"def",
"load_file",
"(",
"self",
",",
"file_path",
",",
"share_name",
",",
"directory_name",
",",
"file_name",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"connection",
".",
"create_file_from_path",
"(",
"share_name",
",",
"directory_name",
",",
"file_name... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureFileShareHook.load_string | Upload a string to Azure File Share.
:param string_data: String to load.
:type string_data: str
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:param file_name: Name of the file.... | airflow/contrib/hooks/azure_fileshare_hook.py | def load_string(self, string_data, share_name, directory_name, file_name, **kwargs):
"""
Upload a string to Azure File Share.
:param string_data: String to load.
:type string_data: str
:param share_name: Name of the share.
:type share_name: str
:param directory_n... | def load_string(self, string_data, share_name, directory_name, file_name, **kwargs):
"""
Upload a string to Azure File Share.
:param string_data: String to load.
:type string_data: str
:param share_name: Name of the share.
:type share_name: str
:param directory_n... | [
"Upload",
"a",
"string",
"to",
"Azure",
"File",
"Share",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_fileshare_hook.py#L174-L191 | [
"def",
"load_string",
"(",
"self",
",",
"string_data",
",",
"share_name",
",",
"directory_name",
",",
"file_name",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"connection",
".",
"create_file_from_text",
"(",
"share_name",
",",
"directory_name",
",",
"file_... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | AzureFileShareHook.load_stream | Upload a stream to Azure File Share.
:param stream: Opened file/stream to upload as the file content.
:type stream: file-like
:param share_name: Name of the share.
:type share_name: str
:param directory_name: Name of the directory.
:type directory_name: str
:para... | airflow/contrib/hooks/azure_fileshare_hook.py | def load_stream(self, stream, share_name, directory_name, file_name, count, **kwargs):
"""
Upload a stream to Azure File Share.
:param stream: Opened file/stream to upload as the file content.
:type stream: file-like
:param share_name: Name of the share.
:type share_name... | def load_stream(self, stream, share_name, directory_name, file_name, count, **kwargs):
"""
Upload a stream to Azure File Share.
:param stream: Opened file/stream to upload as the file content.
:type stream: file-like
:param share_name: Name of the share.
:type share_name... | [
"Upload",
"a",
"stream",
"to",
"Azure",
"File",
"Share",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/azure_fileshare_hook.py#L193-L212 | [
"def",
"load_stream",
"(",
"self",
",",
"stream",
",",
"share_name",
",",
"directory_name",
",",
"file_name",
",",
"count",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"connection",
".",
"create_file_from_stream",
"(",
"share_name",
",",
"directory_name",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | FileProcessorHandler.set_context | Provide filename context to airflow task handler.
:param filename: filename in which the dag is located | airflow/utils/log/file_processor_handler.py | def set_context(self, filename):
"""
Provide filename context to airflow task handler.
:param filename: filename in which the dag is located
"""
local_loc = self._init_file(filename)
self.handler = logging.FileHandler(local_loc)
self.handler.setFormatter(self.form... | def set_context(self, filename):
"""
Provide filename context to airflow task handler.
:param filename: filename in which the dag is located
"""
local_loc = self._init_file(filename)
self.handler = logging.FileHandler(local_loc)
self.handler.setFormatter(self.form... | [
"Provide",
"filename",
"context",
"to",
"airflow",
"task",
"handler",
".",
":",
"param",
"filename",
":",
"filename",
"in",
"which",
"the",
"dag",
"is",
"located"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/log/file_processor_handler.py#L60-L72 | [
"def",
"set_context",
"(",
"self",
",",
"filename",
")",
":",
"local_loc",
"=",
"self",
".",
"_init_file",
"(",
"filename",
")",
"self",
".",
"handler",
"=",
"logging",
".",
"FileHandler",
"(",
"local_loc",
")",
"self",
".",
"handler",
".",
"setFormatter",... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | FileProcessorHandler._init_file | Create log file and directory if required.
:param filename: task instance object
:return: relative log path of the given task instance | airflow/utils/log/file_processor_handler.py | def _init_file(self, filename):
"""
Create log file and directory if required.
:param filename: task instance object
:return: relative log path of the given task instance
"""
relative_path = self._render_filename(filename)
full_path = os.path.join(self._get_log_di... | def _init_file(self, filename):
"""
Create log file and directory if required.
:param filename: task instance object
:return: relative log path of the given task instance
"""
relative_path = self._render_filename(filename)
full_path = os.path.join(self._get_log_di... | [
"Create",
"log",
"file",
"and",
"directory",
"if",
"required",
".",
":",
"param",
"filename",
":",
"task",
"instance",
"object",
":",
"return",
":",
"relative",
"log",
"path",
"of",
"the",
"given",
"task",
"instance"
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/utils/log/file_processor_handler.py#L129-L149 | [
"def",
"_init_file",
"(",
"self",
",",
"filename",
")",
":",
"relative_path",
"=",
"self",
".",
"_render_filename",
"(",
"filename",
")",
"full_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_get_log_directory",
"(",
")",
",",
"relative_pat... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
test | _parse_gcs_url | Given a Google Cloud Storage URL (gs://<bucket>/<blob>), returns a
tuple containing the corresponding bucket and blob. | airflow/contrib/hooks/gcs_hook.py | def _parse_gcs_url(gsurl):
"""
Given a Google Cloud Storage URL (gs://<bucket>/<blob>), returns a
tuple containing the corresponding bucket and blob.
"""
parsed_url = urlparse(gsurl)
if not parsed_url.netloc:
raise AirflowException('Please provide a bucket name')
else:
bucke... | def _parse_gcs_url(gsurl):
"""
Given a Google Cloud Storage URL (gs://<bucket>/<blob>), returns a
tuple containing the corresponding bucket and blob.
"""
parsed_url = urlparse(gsurl)
if not parsed_url.netloc:
raise AirflowException('Please provide a bucket name')
else:
bucke... | [
"Given",
"a",
"Google",
"Cloud",
"Storage",
"URL",
"(",
"gs",
":",
"//",
"<bucket",
">",
"/",
"<blob",
">",
")",
"returns",
"a",
"tuple",
"containing",
"the",
"corresponding",
"bucket",
"and",
"blob",
"."
] | apache/airflow | python | https://github.com/apache/airflow/blob/b69c686ad8a0c89b9136bb4b31767257eb7b2597/airflow/contrib/hooks/gcs_hook.py#L553-L566 | [
"def",
"_parse_gcs_url",
"(",
"gsurl",
")",
":",
"parsed_url",
"=",
"urlparse",
"(",
"gsurl",
")",
"if",
"not",
"parsed_url",
".",
"netloc",
":",
"raise",
"AirflowException",
"(",
"'Please provide a bucket name'",
")",
"else",
":",
"bucket",
"=",
"parsed_url",
... | b69c686ad8a0c89b9136bb4b31767257eb7b2597 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.