You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running any dbt commands when UTC timezone is 1 calendar day ahead of the local timezone dbt can't create a new log file. The error returned is: FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'logs\\dbt.log' ->
This occurred running dbt 15b2 on a windows based OS.
Steps To Reproduce
Check to see if your local time is 1 calendar date behind UTC. A use-case maybe running dbt at or near midnight local-time (UTC-5 in my case) and attempt to compile a dbt project.
Expected behavior
dbt will return an FileExistError: [WinError 183].
Screenshots and log output
2019-10-25 03:10:31,150080 (MainThread): Running with dbt=0.15.0-b2
2019-10-25 03:10:31,478080 (MainThread): running dbt with arguments Namespace(cls=<class 'dbt.task.test.TestTask'>, data=False, debug=True, exclude=None, log_cache_events=False, log_format='default', models=['dim_agency_assert_agency_id'], partial_parse=None, profile=None, profiles_dir='C:\\Users\\dbt_fan\\.dbt', project_dir=None, record_timing_info=None, rpc_method='test', schema=False, single_threaded=False, strict=False, target=None, test_new_parser=False, threads=None, use_cache=True, vars='{}', version_check=True, warn_error=False, which='test', write_json=True)
2019-10-25 03:10:31,480087 (MainThread): Encountered an error:
2019-10-25 03:10:31,480087 (MainThread): [WinError 183] Cannot create a file when that file already exists: 'logs\\dbt.log' -> 'C:\\source\\my_dbt\\logs\\dbt-2019-10-24.log'
2019-10-25 03:10:31,482083 (MainThread): Traceback (most recent call last):
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\dbt\main.py", line 80, in main
results, succeeded = handle_and_check(args)
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\dbt\main.py", line 158, in handle_and_check
task, res = run_from_args(parsed)
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\dbt\main.py", line 204, in run_from_args
log_manager.set_path(log_path)
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\dbt\logger.py", line 483, in set_path
self._file_handler.set_path(path)
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\dbt\logger.py", line 383, in set_path
self._replay_buffered()
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\dbt\logger.py", line 402, in _replay_buffered
super().emit(record)
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\logbook\handlers.py", line 980, in emit
self.perform_rollover(new_timestamp)
File "c:\users\dbt_fan\appdata\local\programs\python\python37\lib\site-packages\logbook\handlers.py", line 962, in perform_rollover
os.rename(self._filename, filename)
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'logs\\dbt.log' -> 'C:\\source\\my_dbt\\logs\\dbt-2019-10-24.log'
There's a lot of weird stuff here though, and I think it's because logbook's TimedRotatingFileHandler depends upon the file's mtime. I'm inclined to fix this by changing to a size-based rotating handler instead of time.
Describe the bug
When running any dbt commands when UTC timezone is 1 calendar day ahead of the local timezone dbt can't create a new log file. The error returned is:
FileExistsError: [WinError 183] Cannot create a file when that file already exists: 'logs\\dbt.log' ->
This occurred running dbt 15b2 on a windows based OS.
Steps To Reproduce
Check to see if your local time is 1 calendar date behind UTC. A use-case maybe running dbt at or near midnight local-time (UTC-5 in my case) and attempt to compile a dbt project.
Expected behavior
dbt will return an FileExistError: [WinError 183].
Screenshots and log output
System information
Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using:
Windows 10
The output of
python --version
:Python 3.7.2
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: