leandron commented on a change in pull request #8770:
URL: https://github.com/apache/tvm/pull/8770#discussion_r691020815



##########
File path: python/tvm/contrib/utils.py
##########
@@ -99,7 +99,8 @@ def __init__(self, custom_path=None):
 
         self._created_with_keep_for_debug = self._KEEP_FOR_DEBUG
         if custom_path:
-            os.mkdir(custom_path)
+            if not os.path.exists(custom_path):
+                os.makedirs(custom_path)

Review comment:
       Hi @huanmei9, thanks for the PR. Do you mind clarifying on what is the 
use case for this change? As @Mousius commented, it is not usually good 
practice to run tests on a polluted directory, that contains files from 
previous executions.
   
   Apart from that, as others suggested, here a built-in suggestion 
([ref](https://docs.python.org/3/library/os.html#os.makedirs)) that can avoid 
the need to the `if ...` block on this PR:
   
   ```suggestion
               os.makedirs(custom_path, exist_ok=True)
   ```
   
   But still I'm not sure we want to be blindly reusing directories as 
temporary directories for tests. Interested to know some other opinions. What 
do you think?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to