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

Create .lock directory #839

Merged
merged 3 commits into from
Mar 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions chainercv/datasets/ade20k/ade20k_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@


def get_ade20k(root, url):
data_root = download.get_dataset_directory(root)
# To support ChainerMN, the target directory should be locked.
with filelock.FileLock(os.path.join(data_root, 'lock')):
with filelock.FileLock(os.path.join(download.get_dataset_directory(
'pfnet/chainercv/.lock'), 'ade20k.lock')):
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)
Expand Down
7 changes: 4 additions & 3 deletions chainercv/datasets/camvid/camvid_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@


def get_camvid():
data_root = download.get_dataset_directory(root)
# To support ChainerMN, the target directory should be locked.
with filelock.FileLock(os.path.join(data_root, 'lock')):
with filelock.FileLock(os.path.join(download.get_dataset_directory(
'pfnet/chainercv/.lock'), 'camvid.lock')):
data_root = download.get_dataset_directory(root)
download_file_path = utils.cached_download(url)
if len(glob.glob(os.path.join(data_root, '*'))) != 10:
if len(glob.glob(os.path.join(data_root, '*'))) != 9:
utils.extractall(
download_file_path, data_root, os.path.splitext(url)[1])
data_dir = os.path.join(data_root, 'SegNet-Tutorial-master/CamVid')
Expand Down
5 changes: 3 additions & 2 deletions chainercv/datasets/coco/coco_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@


def get_coco(split, img_split, year, mode):
data_dir = download.get_dataset_directory(root)
# To support ChainerMN, the target directory should be locked.
with filelock.FileLock(os.path.join(data_dir, 'lock')):
with filelock.FileLock(os.path.join(download.get_dataset_directory(
'pfnet/chainercv/.lock'), 'coco.lock')):
data_dir = download.get_dataset_directory(root)
annos_root = os.path.join(data_dir, 'annotations')
img_root = os.path.join(data_dir, 'images')
created_img_root = os.path.join(
Expand Down
10 changes: 6 additions & 4 deletions chainercv/datasets/cub/cub_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@


def get_cub():
data_root = download.get_dataset_directory(root)
# To support ChainerMN, the target directory should be locked.
with filelock.FileLock(os.path.join(data_root, 'lock')):
with filelock.FileLock(os.path.join(download.get_dataset_directory(
'pfnet/chainercv/.lock'), 'cub.lock')):
data_root = download.get_dataset_directory(root)
base_path = os.path.join(data_root, 'CUB_200_2011')
if os.path.exists(base_path):
# skip downloading
Expand All @@ -31,9 +32,10 @@ def get_cub():


def get_cub_prob_map():
data_root = download.get_dataset_directory(root)
# To support ChainerMN, the target directory should be locked.
with filelock.FileLock(os.path.join(data_root, 'lock')):
with filelock.FileLock(os.path.join(download.get_dataset_directory(
'pfnet/chainercv/.lock'), 'cub.lock')):
data_root = download.get_dataset_directory(root)
base_path = os.path.join(data_root, 'segmentations')
if os.path.exists(base_path):
# skip downloading
Expand Down
5 changes: 3 additions & 2 deletions chainercv/datasets/online_products/online_products_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@


def _get_online_products():
data_root = download.get_dataset_directory(root)
# To support ChainerMN, the target directory should be locked.
with filelock.FileLock(os.path.join(data_root, 'lock')):
with filelock.FileLock(os.path.join(download.get_dataset_directory(
'pfnet/chainercv/.lock'), 'online_products.lock')):
data_root = download.get_dataset_directory(root)
base_path = os.path.join(data_root, 'Stanford_Online_Products')
if os.path.exists(base_path):
# skip downloading
Expand Down
5 changes: 3 additions & 2 deletions chainercv/datasets/sbd/sbd_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ def _generate_voc2012_txt(base_path):


def get_sbd():
data_root = download.get_dataset_directory(root)
# To support ChainerMN, the target directory should be locked.
with filelock.FileLock(os.path.join(data_root, 'lock')):
with filelock.FileLock(os.path.join(download.get_dataset_directory(
'pfnet/chainercv/.lock'), 'sbd.lock')):
data_root = download.get_dataset_directory(root)
base_path = os.path.join(data_root, 'benchmark_RELEASE/dataset')

train_voc2012_file = os.path.join(base_path, 'train_voc2012.txt')
Expand Down
5 changes: 3 additions & 2 deletions chainercv/datasets/voc/voc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ def get_voc(year, split):
if split == 'test' and year == '2007':
key = '2007_test'

data_root = download.get_dataset_directory(root)
# To support ChainerMN, the target directory should be locked.
with filelock.FileLock(os.path.join(data_root, 'lock')):
with filelock.FileLock(os.path.join(download.get_dataset_directory(
'pfnet/chainercv/.lock'), 'voc.lock')):
data_root = download.get_dataset_directory(root)
base_path = os.path.join(data_root, 'VOCdevkit/VOC{}'.format(year))
split_file = os.path.join(
base_path, 'ImageSets/Main/{}.txt'.format(split))
Expand Down