Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Commit

Permalink
aqure lock before extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakuyume committed Feb 8, 2019
1 parent 4130990 commit a79ff23
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions chainercv/datasets/ade20k/ade20k_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
# https://github.com/CSAILVision/sceneparsing

import os
import filelock

from chainer.dataset import download
from chainercv import utils


def get_ade20k(root, url):
data_root = download.get_dataset_directory(root)
if os.path.exists(os.path.join(data_root, 'ADEChallengeData2016')):
return data_root
cache_path = utils.cached_download(url)
utils.extractall(cache_path, data_root, os.path.splitext(url)[1])
# To support ChainerMN, target directory should be locked
# before extracting ADE20K.
with filelock.FileLock(os.path.join(data_root, 'lock')):
if os.path.exists(os.path.join(data_root, 'ADEChallengeData2016')):
return data_root
cache_path = utils.cached_download(url)
utils.extractall(cache_path, data_root, os.path.splitext(url)[1])
return data_root


Expand Down

0 comments on commit a79ff23

Please sign in to comment.