Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit 37ef95b

Browse files
authored
Merge pull request #46 from Azure/develop
Fix for data_dir not existing when logfile created and prep for release
2 parents b514a66 + 8dac7ff commit 37ef95b

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

CHANGES.txt

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2019.05.06 v0.25.0
2+
------------------
3+
- Bug fix for log directory not existing when it is created and path building on Maya 2019
4+
5+
16
2019.30.05 v0.24.0
27
------------------
38
- Numerous small bug fixes

azure_batch_maya/plug-in/AzureBatch.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"azure-batch-extensions==1.0.1": "azure.batch_extensions"
5555
}
5656

57-
VERSION = "0.24.0"
57+
VERSION = "0.25.0"
5858
EULA_PREF = "AzureBatch_EULA"
5959
SHELF_FILE = "shelf_AzureBatch.mel"
6060
cmd_name = "AzureBatch"

azure_batch_maya/scripts/config.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ class AzureBatchConfig(object):
5050

5151
def __init__(self):
5252
self._data_dir = os.path.join(maya.prefs_dir(), 'AzureBatchData')
53+
if not os.path.isdir(self._data_dir):
54+
try:
55+
os.makedirs(self._data_dir)
56+
except OSError as exc: # Guard against race condition
57+
if exc.errno != errno.EEXIST:
58+
raise
59+
5360
self._log = self._configure_logging(LOG_LEVELS['debug']) #config hasn't been loaded yet so use a default logging level
5461

5562
def initialize_ui(self, index, settings, frame, start, call):
@@ -269,8 +276,6 @@ def _configure_plugin(self, from_auth_button):
269276
"""Set up the config file, authenticate the SDK clients
270277
and set up the log file.
271278
"""
272-
if not os.path.exists(self._data_dir):
273-
os.makedirs(self._data_dir)
274279
config_file = os.path.join(self._data_dir, self._ini_file)
275280

276281
try:
@@ -415,7 +420,7 @@ def _configure_logging(self, log_level):
415420
if len(logger.handlers) == 0:
416421
file_format = logging.Formatter(
417422
"%(asctime)-15s [%(levelname)s] %(module)s: %(message)s")
418-
logfile = os.path.join(self._data_dir, "azure_batch.log")
423+
logfile = os.path.normpath(os.path.join(self._data_dir, "azure_batch.log"))
419424
if not os.path.exists(logfile):
420425
with open(logfile, 'w') as handle:
421426
handle.write("Azure Batch Plugin Log\n")

0 commit comments

Comments
 (0)