Fix resource package in windows (#308)

* move import resource

* move import resource
This commit is contained in:
Mashiro 2022-06-17 14:43:27 +08:00 committed by GitHub
parent 4a4d6b1ab2
commit bc763758d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,6 @@ import copy
import os.path as osp import os.path as osp
import platform import platform
import random import random
import resource
import time import time
import warnings import warnings
from collections import OrderedDict from collections import OrderedDict
@ -634,6 +633,7 @@ class Runner:
# https://github.com/pytorch/pytorch/issues/973 # https://github.com/pytorch/pytorch/issues/973
# set resource limit # set resource limit
if platform.system() != 'Windows': if platform.system() != 'Windows':
import resource
rlimit = resource.getrlimit(resource.RLIMIT_NOFILE) rlimit = resource.getrlimit(resource.RLIMIT_NOFILE)
base_soft_limit = rlimit[0] base_soft_limit = rlimit[0]
hard_limit = rlimit[1] hard_limit = rlimit[1]