-
Notifications
You must be signed in to change notification settings - Fork 398
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
Exporter: detect & handle deleted workspace objects (notebooks/files/directories) when running in incremental mode #3225
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #3225 +/- ##
==========================================
+ Coverage 83.60% 83.77% +0.17%
==========================================
Files 169 170 +1
Lines 15094 15301 +207
==========================================
+ Hits 12619 12819 +200
+ Misses 1735 1731 -4
- Partials 740 751 +11
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @alexott, I have some comments, mentioned them. Right now, we don't have E2E tests for exporter but just to check, has this been tested E2E?
exporter/context.go
Outdated
@@ -499,6 +529,110 @@ func (ic *importContext) Run() error { | |||
return nil | |||
} | |||
|
|||
func isSupportedWsObject(obj workspace.ObjectStatus) bool { | |||
return obj.ObjectType == workspace.Directory || obj.ObjectType == workspace.Notebook || obj.ObjectType == workspace.File |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a list of supported objects and then checking in that would be better, we could extend it to other objects in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reimplemented as switch
, but really we can detect changes only in specific resources...
case workspace.Notebook: | ||
rtype = "databricks_notebook" | ||
default: | ||
log.Printf("[WARN] Unsupported WS object type: %s in obj %v", obj.ObjectType, obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we fail here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's too late to fail - it's better to don't some missing code that could be added manually, than fail multi-hour work. Although, this block is just defensive piece - because we have filters earlier we don't reach it.
p := ic.oldWorkspaceObjectMapping[object.ObjectID] | ||
if p == "" || p == object.Path { | ||
log.Printf("[DEBUG] skipping '%s' that was modified at %d (last active=%d)", | ||
object.Path, modifiedAt, updatedSinceMs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is last active same as last updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Last Active - when the exporter ran last time...
Most of the tests in |
Changes
The initial version of code for detection & handling of removed workspace objects (notebooks, workspace files, and directories) and associated permissions... Renames are handled as (delete/create new)...
Tests
make test
run locallydocs/
folderinternal/acceptance