dbx-sync 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dbx-sync
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: Synchronize Databricks workspace content with a local directory.
5
5
  Project-URL: Repository, https://github.com/gramhagen/dbx-sync
6
6
  Author: gramhagen
@@ -2,4 +2,4 @@
2
2
 
3
3
  __all__ = ["__version__"]
4
4
 
5
- __version__ = "0.2.0"
5
+ __version__ = "0.3.0"
@@ -621,6 +621,20 @@ def run_forever(config: dict[str, Any], config_path: Path, dry_run: bool) -> int
621
621
  result["removed"],
622
622
  result["skipped"],
623
623
  )
624
+ if result["conflicts"] > 0:
625
+ conflicted_paths = [
626
+ path
627
+ for path, state in config.get("files", {}).items()
628
+ if state.get("last_action") == "conflict"
629
+ ]
630
+ LOGGER.error(
631
+ "Stopping watch mode: %d conflict(s) detected. "
632
+ "Conflicting file(s): %s. "
633
+ "Run with --force to clear sync state and retry.",
634
+ result["conflicts"],
635
+ ", ".join(conflicted_paths),
636
+ )
637
+ return 1
624
638
 
625
639
  time.sleep(int(config["poll_interval_seconds"]))
626
640
  except KeyboardInterrupt:
@@ -804,6 +804,30 @@ def test_run_forever_retries_after_sync_pass_failure(
804
804
  assert mock_sleep.call_count == 2
805
805
 
806
806
 
807
+ @patch("dbx_sync.sync.time.sleep", side_effect=KeyboardInterrupt)
808
+ @patch(
809
+ "dbx_sync.sync.run_sync_pass",
810
+ return_value={"downloaded": 0, "uploaded": 0, "conflicts": 1, "removed": 0, "skipped": 0},
811
+ )
812
+ def test_run_forever_exits_on_conflict(
813
+ mock_run_sync_pass: MagicMock, mock_sleep: MagicMock, tmp_path: Path
814
+ ) -> None:
815
+ config = {
816
+ "local_dir": str(tmp_path),
817
+ "remote_path": "/workspace",
818
+ "poll_interval_seconds": 1,
819
+ "files": {
820
+ "/workspace/nb": {**sync._default_file_state(), "last_action": "conflict"},
821
+ },
822
+ }
823
+
824
+ result = sync.run_forever(config, tmp_path / "config.json", dry_run=False)
825
+
826
+ assert result == 1
827
+ mock_run_sync_pass.assert_called_once()
828
+ mock_sleep.assert_not_called()
829
+
830
+
807
831
  @patch(
808
832
  "dbx_sync.sync.run_sync_pass",
809
833
  return_value={"downloaded": 0, "uploaded": 0, "conflicts": 0, "removed": 0, "skipped": 0},
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes