Skip to content

Commit

Permalink
Drop synchronizer fork (jupyter-server#355)
Browse files Browse the repository at this point in the history
* drop forked code

* Bump to 0.19.1
  • Loading branch information
Zsailer authored and GitHub Enterprise committed May 6, 2022
1 parent 7ceb959 commit 248d05f
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 66 deletions.
2 changes: 1 addition & 1 deletion data_studio_jupyter_extensions/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.19.0" # pragma: no cover
__version__ = "0.19.1" # pragma: no cover
61 changes: 0 additions & 61 deletions data_studio_jupyter_extensions/configurables/session_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,64 +111,3 @@ async def list_sessions(self):
event={"state": "Synced."},
)
return out

# --------------------- Temporarily inline these methods until synchronizer 0.0.6 is ready

def save(self, record: KernelRecord) -> None:
fields = {
k: v
for k, v in record.get_active_fields().items()
if k in self._table_columns
}
columns = ",".join(fields.keys())
values_tuple = tuple(fields.values())
if len(values_tuple) > 1:
values = str(values_tuple)
else:
values = f"('{values_tuple[0]}')"
self.cursor.execute(
f"INSERT INTO {self._table_name} ({columns}) VALUES {values}"
)

def update(self, record: KernelRecord) -> None:
found = False
for record_field in record.get_identifier_fields():
record_id = getattr(record, record_field)
if record_id and self.exists(**{record_field: record_id}):
found = True
break
if not found:
raise Exception(
"No KernelRecord found in the KernelTable. "
"If this is a new record, use the `.save` method to store "
"the KernelRecord."
)

# Build the query for updating columns.
fields = {
k: v
for k, v in record.get_active_fields().items()
if k in self._table_columns
}
updates = []
for key, value in fields.items():
updates.append(f"{key}='{value}'")
update_string = ", ".join(updates)
x = f"UPDATE {self._table_name} SET {update_string} WHERE {record_field}='{record_id}';"
self.cursor.execute(x)

def row_to_record(self, row) -> KernelRecord:
items = {field: row[field] for field in self._table_columns}
return self.kernel_record_class(**items) # type:ignore[no-any-return]

def list(self):
self.cursor.execute(f"SELECT * FROM {self._table_name}")
rows = self.cursor.fetchall()
return [self.row_to_record(row) for row in rows]

def get(self, **identifier) -> KernelRecord:
self.query("SELECT * FROM {table} WHERE {0}=?", **identifier)
row = self.cursor.fetchone()
if not row:
raise Exception("No match was found in database.")
return self.row_to_record(row)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ testpaths = [
]

[tool.tbump.version]
current = "0.19.0"
current = "0.19.1"
regex = '''
(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
((?P<channel>a|b|rc|.dev)(?P<release>\d+))?
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ install_requires =
jupyter_client~=7.3.0
validators~=0.18.2
pycryptodome~=3.14.1
jupyter_server_synchronizer==0.0.5
jupyter_server_synchronizer==0.0.6

[options.entry_points]
jupyter_client.kernel_provisioners =
Expand Down
2 changes: 1 addition & 1 deletion src/status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { ISessionContext, ReactWidget } from '@jupyterlab/apputils';
import { TelemetryListener } from './telemetrylistener';

// This is managed by tbump config in pyproject.toml
const VERSION = '0.19.0';
const VERSION = '0.19.1';

// Define the error states
// https://github.pie.apple.com/pie-data-studio/notebook-service/blob/761d63604966db5918d2e491c0f89cce454b7f67/app/com/apple/datastudio/model/ResourceState.scala#L20
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.19.0
0.19.1

0 comments on commit 248d05f

Please sign in to comment.