2828from .lib import DatalakeRESTInterface
2929from .utils import ensure_writable , read_block
3030from .enums import ExpiryOptionType
31- from .retry import ExponentialRetryPolicy
31+ from .retry import ExponentialRetryPolicy , NoRetryPolicy
3232from .multiprocessor import multi_processor_change_acl
3333
3434if sys .version_info >= (3 , 4 ):
3939logger = logging .getLogger (__name__ )
4040valid_expire_types = [x .value for x in ExpiryOptionType ]
4141
42+
4243class AzureDLFileSystem (object ):
4344 """
4445 Access Azure DataLake Store as if it were a file-system
@@ -57,16 +58,18 @@ class AzureDLFileSystem(object):
5758 The API version to target with requests. Changing this value will
5859 change the behavior of the requests, and can cause unexpected behavior or
5960 breaking changes. Changes to this value should be undergone with caution.
61+ per_call_timeout_seconds : float(60)
62+ This is the timeout for each requests library call.
6063 kwargs: optional key/values
6164 See ``lib.auth()``; full list: tenant_id, username, password, client_id,
6265 client_secret, resource
6366 """
6467 _singleton = [None ]
6568
66- def __init__ (self , token = None , ** kwargs ):
67- # store instance vars
69+ def __init__ (self , token = None , per_call_timeout_seconds = 60 , ** kwargs ):
6870 self .token = token
6971 self .kwargs = kwargs
72+ self .per_call_timeout_seconds = per_call_timeout_seconds
7073 self .connect ()
7174 self .dirs = {}
7275 self ._emptyDirs = []
@@ -85,7 +88,7 @@ def connect(self):
8588 """
8689 Establish connection object.
8790 """
88- self .azure = DatalakeRESTInterface (token = self .token , ** self .kwargs )
91+ self .azure = DatalakeRESTInterface (token = self .token , req_timeout_s = self . per_call_timeout_seconds , ** self .kwargs )
8992 self .token = self .azure .token
9093
9194 def __setstate__ (self , state ):
@@ -775,16 +778,18 @@ def concat(self, outfile, filelist, delete_source=False):
775778 sourceList = [AzureDLPath (f ).as_posix () for f in filelist ]
776779 sources = {}
777780 sources ["sources" ] = sourceList
781+
778782 self .azure .call ('MSCONCAT' , outfile .as_posix (),
779783 data = bytearray (json .dumps (sources ,separators = (',' , ':' )), encoding = "utf-8" ),
780784 deleteSourceDirectory = delete ,
781- headers = {'Content-Type' : "application/json" })
785+ headers = {'Content-Type' : "application/json" },
786+ retry_policy = NoRetryPolicy ())
782787 self .invalidate_cache (outfile )
783788
784789 merge = concat
785790
786791 def cp (self , path1 , path2 ):
787- """ Copy file between locations on ADL """
792+ """ Not implemented. Copy file between locations on ADL """
788793 # TODO: any implementation for this without download?
789794 raise NotImplementedError
790795
0 commit comments