Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbt reporting FileExistsError [WinError 183] #1865

Closed
4 tasks
Carolus-Holman opened this issue Oct 25, 2019 · 1 comment · Fixed by #1871
Closed
4 tasks

dbt reporting FileExistsError [WinError 183] #1865

Carolus-Holman opened this issue Oct 25, 2019 · 1 comment · Fixed by #1871
Labels
bug Something isn't working

Comments

@Carolus-Holman
Copy link
Contributor

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

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'

System information

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • [* ] snowflake
  • other (specify: ____________)

The output of dbt --version:

installed version: 0.15.0-b2
latest version: 0.14.3

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.

@Carolus-Holman Carolus-Holman added bug Something isn't working triage labels Oct 25, 2019
@drewbanin drewbanin removed the triage label Oct 28, 2019
@drewbanin drewbanin added this to the Louisa May Alcott milestone Oct 28, 2019
@beckjake
Copy link
Contributor

This looks like this bug: getlogbook/logbook#280

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants