MCPcopy Create free account
hub / github.com/catboost/catboost / set_tmp_dir

Function set_tmp_dir

library/python/tmp/__init__.py:19–35  ·  view source on GitHub ↗
(root, keep_dir)

Source from the content-addressed store, hash-verified

17
18
19def set_tmp_dir(root, keep_dir):
20 uniq_name = '{0}.{1}.{2}'.format(int(time.time()), os.getpid(), uniq_id.gen8())
21 tmp_dir = os.path.join(root, uniq_name)
22 fs.create_dirs(tmp_dir)
23
24 old_tmp_dir = os.environ.get('TMPDIR')
25 logger.debug('Set TMPDIR=%s instead of %s', tmp_dir, old_tmp_dir)
26 os.environ['TMPDIR'] = tmp_dir
27
28 global _startup_tmp_dir
29 global _startup_tmp_dir_set
30 if not _startup_tmp_dir_set:
31 _startup_tmp_dir = old_tmp_dir
32 _startup_tmp_dir_set = True
33
34 if not keep_dir:
35 _tmp_roots.append(tmp_dir)
36
37
38def remove_tmp_dirs(env=None):

Callers

nothing calls this directly

Calls 6

intFunction · 0.50
formatMethod · 0.45
joinMethod · 0.45
getMethod · 0.45
debugMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected