提交 fa5c3849 编写于 作者: B barrierye

bug fix

上级 e48fafb3
...@@ -223,7 +223,12 @@ class HadoopMonitor(Monitor): ...@@ -223,7 +223,12 @@ class HadoopMonitor(Monitor):
local_dirpath = os.path.join(local_tmp_path, dirname) local_dirpath = os.path.join(local_tmp_path, dirname)
if os.path.exists(local_dirpath): if os.path.exists(local_dirpath):
_LOGGER.info('remove old temporary model file({}).'.format(dirname)) _LOGGER.info('remove old temporary model file({}).'.format(dirname))
shutil.rmtree(local_dirpath) if self._unpacked_filename is None:
# the remote file is model folder.
shutil.rmtree(local_dirpath)
else:
# the remote file is a packed model file
os.remove(local_dirpath)
remote_dirpath = os.path.join(remote_path, dirname) remote_dirpath = os.path.join(remote_path, dirname)
cmd = '{} -get {} {} 2>/dev/null'.format(self._cmd_prefix, cmd = '{} -get {} {} 2>/dev/null'.format(self._cmd_prefix,
remote_dirpath, local_dirpath) remote_dirpath, local_dirpath)
...@@ -304,8 +309,8 @@ class FTPMonitor(Monitor): ...@@ -304,8 +309,8 @@ class FTPMonitor(Monitor):
os.path.join(remote_path, remote_dirname), name, os.path.join(remote_path, remote_dirname), name,
os.path.join(local_tmp_path, remote_dirname), overwrite) os.path.join(local_tmp_path, remote_dirname), overwrite)
else: else:
self._download_remote_file(remote_dirname, name, self._download_remote_file(remote_dirpath, name,
local_tmp_path, overwrite) local_dirpath, overwrite)
except ftplib.error_perm: except ftplib.error_perm:
_LOGGER.debug('{} is file.'.format(remote_dirname)) _LOGGER.debug('{} is file.'.format(remote_dirname))
self._download_remote_file(remote_path, remote_dirname, self._download_remote_file(remote_path, remote_dirname,
......
...@@ -223,7 +223,12 @@ class HadoopMonitor(Monitor): ...@@ -223,7 +223,12 @@ class HadoopMonitor(Monitor):
local_dirpath = os.path.join(local_tmp_path, dirname) local_dirpath = os.path.join(local_tmp_path, dirname)
if os.path.exists(local_dirpath): if os.path.exists(local_dirpath):
_LOGGER.info('remove old temporary model file({}).'.format(dirname)) _LOGGER.info('remove old temporary model file({}).'.format(dirname))
shutil.rmtree(local_dirpath) if self._unpacked_filename is None:
# the remote file is model folder.
shutil.rmtree(local_dirpath)
else:
# the remote file is a packed model file
os.remove(local_dirpath)
remote_dirpath = os.path.join(remote_path, dirname) remote_dirpath = os.path.join(remote_path, dirname)
cmd = '{} -get {} {} 2>/dev/null'.format(self._cmd_prefix, cmd = '{} -get {} {} 2>/dev/null'.format(self._cmd_prefix,
remote_dirpath, local_dirpath) remote_dirpath, local_dirpath)
...@@ -304,8 +309,8 @@ class FTPMonitor(Monitor): ...@@ -304,8 +309,8 @@ class FTPMonitor(Monitor):
os.path.join(remote_path, remote_dirname), name, os.path.join(remote_path, remote_dirname), name,
os.path.join(local_tmp_path, remote_dirname), overwrite) os.path.join(local_tmp_path, remote_dirname), overwrite)
else: else:
self._download_remote_file(remote_dirname, name, self._download_remote_file(remote_dirpath, name,
local_tmp_path, overwrite) local_dirpath, overwrite)
except ftplib.error_perm: except ftplib.error_perm:
_LOGGER.debug('{} is file.'.format(remote_dirname)) _LOGGER.debug('{} is file.'.format(remote_dirname))
self._download_remote_file(remote_path, remote_dirname, self._download_remote_file(remote_path, remote_dirname,
...@@ -348,7 +353,7 @@ class GeneralMonitor(Monitor): ...@@ -348,7 +353,7 @@ class GeneralMonitor(Monitor):
url = '{}/{}'.format(self._general_host, remote_dirpath) url = '{}/{}'.format(self._general_host, remote_dirpath)
_LOGGER.debug('remote file url: {}'.format(url)) _LOGGER.debug('remote file url: {}'.format(url))
if self._unpacked_filename is None: if self._unpacked_filename is None:
# the remote file is model folder # the remote file is model folder.
cmd = 'wget -nH -r -P {} {} &>/dev/null'.format( cmd = 'wget -nH -r -P {} {} &>/dev/null'.format(
os.path.join(local_tmp_path, dirname), url) os.path.join(local_tmp_path, dirname), url)
else: else:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册