You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Julian de Ruiter (JIRA)" <ji...@apache.org> on 2018/06/20 15:21:00 UTC
[jira] [Commented] (AIRFLOW-2651) Add file system hooks with a
common interface
[ https://issues.apache.org/jira/browse/AIRFLOW-2651?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16518260#comment-16518260 ]
Julian de Ruiter commented on AIRFLOW-2651:
-------------------------------------------
A PR implementing file system hooks for several file systems (FTP/FTPS, HDFS, S3, SFTP and local) is available here: https://github.com/apache/incubator-airflow/pull/3526.
> Add file system hooks with a common interface
> ---------------------------------------------
>
> Key: AIRFLOW-2651
> URL: https://issues.apache.org/jira/browse/AIRFLOW-2651
> Project: Apache Airflow
> Issue Type: Improvement
> Components: hooks
> Affects Versions: 1.9.0
> Reporter: Julian de Ruiter
> Assignee: Julian de Ruiter
> Priority: Major
> Labels: pull-request-available
>
> Currently, the usability of the different file systems hooks (e.g. HDFSHook, SFTPHook, etc.) is limited by the fact (a) that the hooks do not expose a common interface and (b) that the hooks do not expose basic file system functions such as `open`, limiting their flexibility for manipulating files outside of their standard functions (e.g., writing files directly, writing file objects, etc.).
> To fix this, I propose to add define a common interface for file system hooks, which can be used to manipulate files on different file systems. Moreover, as they all implement the same interface, these hooks can be used interchangeably. The proposed interface is based on os/shutil functions that are commonly used for manipulating files.
> This currently includes the following methods, with their local/builtin equivalents in brackets:
> * open (builtin open)
> * exists (os.path.exists)
> * isdir (os.path.isdir)
> * walk (os.walk)
> * makedir (os.makedir)
> * makedirs (os.makedirs)
> * rm (os.unlink)
> * rmtree (shutil.rmtree)
> * glob (glob.glob)
> Besides this, the interface includes the following methods for manipulating paths:
> * join (os.path.join)
> * split (os.path.split)
> * dirname (os.path.dirname)
> * basename (os.path.basename)
> Additionally, we could add some additional functions (not yet implemented) to add basic functionality for copying/moving files. This could include (for example) the following:
> * copy (for copying files, possibly with glob)
> * move (for moving files, possibly with glob)
> * copy_tree
> * move_tree
> These functions should be based upon the other methods listed above, to avoid having each hook implementing these functions separately (and reducing the burden of creating additional hooks). They can of course be overridden if more efficient functions are available.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)