Skip to content

Commit 8424a8e

Browse files
committed
Revised remote registration docs
1 parent 34db2fe commit 8424a8e

File tree

1 file changed

+28
-55
lines changed

1 file changed

+28
-55
lines changed

README.md

Lines changed: 28 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ These should match the relevant column type. Mapped variables are substituted in
307307
A `variables` map usually isn't needed for simple queries. The basic condition string should automatically get converted to a meaningful type, but when this fails
308308
replacing tricky elements with a variable may help.
309309

310-
### Remote registration
310+
### Remote registration [Experimental - OMERO Plus Only]
311311

312312
For **OMERO Plus** installations which support TileDB as the OMERO.tables backend
313313
it is possible to register tables in-place in a similar manner to in-place image
@@ -329,7 +329,7 @@ For this mode to be available extra dependencies must also be installed as follo
329329
pip install omero2pandas[remote]
330330
```
331331

332-
To activate this mode use `omero2pandas.upload_table` with arguments as
332+
To use remote registration supply the `local_path` argument to `omero2pandas.upload_table` as
333333
follows:
334334

335335
```python
@@ -339,22 +339,12 @@ db_path = omero2pandas.upload_table("/path/to/my_data.csv", "Name for table",
339339
# Returns the path to the created tiledb file
340340
```
341341

342-
Similar to regular table uploads, the input can be a dataframe in memory or a
343-
csv file on disk. The input will be copied into a new TileDB database and
344-
registered to OMERO in-place.
342+
This will convert the table into a TileDB database which will be written to `local_path`, then attempt to
343+
register this to OMERO in-place. For this to work the local_path needs to be visible on the server machine
344+
as well (e.g. a network drive).
345345

346-
To perform this kind of registration you need to provide the `local_path` argument
347-
to the standard `omero2pandas.upload_table` function (alongside required params for
348-
a "normal" upload e.g. server connection details). The local path is the file path
349-
where the tiledb file will be written to and registered to OMERO from.
350-
If you provide a directory instead the tiledb file will be named based on the `table_name` argument.
351-
352-
Naturally, the OMERO server will need to be able to access the resulting tiledb file
353-
in order to be registered. If the `local_path` is also visible from the server machine
354-
(e.g. you're running the upload on the server itself) then that's sufficient. Otherwise
355-
a `remote_path` argument is also available to tell the server where it should
356-
find the table. This is typically needed if the tiledb file ends up mounted at a
357-
different location between the local machine and the OMERO server.
346+
If shared storage is mounted differently from the server's point of view, you can also supply the `remote_path`
347+
parameter to declare where OMERO should find the resulting TileDB file.
358348

359349
For example, if registering from a Windows machine with a network drive to an OMERO server on Linux:
360350
```python
@@ -370,52 +360,35 @@ is where that file will be from the OMERO server's point of view. No remote path
370360
implies that both machines will see the file at the local path.
371361

372362
Note that when a table is registered remotely it is not part of the Managed Repository
373-
used to store OMERO data. This means that it becomes the user's responsibility to
363+
used to store OMERO data. This means that it becomes the **user's responsibility** to
374364
update the table object on the OMERO server if the file is moved/deleted.
375365

376-
#### How it works
366+
#### Running remote registration steps individually
367+
368+
If your system lacks shared storage you may want to split the TileDB creation and registration steps
369+
so that data can be manually copied to the server. It is possible to run steps from the `upload_table`
370+
workflow individually.
377371

378-
Remote registration is a two-step process: conversion to TileDB format followed
379-
by registration using a HTTP API.
372+
The remote registration API requires the exchange of a "SecretToken" metadata key
373+
which should be present in the the TileDB array metadata. This check verifies that the
374+
user does have access to the table they want to register (as they know the token value)
375+
and that the file seen by the server is indeed the one the user asked to register.
380376

381-
The TileDB conversion is handled automatically by omero2pandas. This largely involves
382-
creating a TileDB database from your dataframe and adding a few details to
383-
the converted table array metadata. Most native pandas column types are supported.
377+
```python
378+
from omero2pandas.remote import create_tiledb, register_table
379+
# Create the tiledb and retrieve the SecretToken
380+
secret_token = create_tiledb(df, "/path/to/my.tiledb")
384381

385-
The actual registration involves telling the server that we'd like to register a
386-
remote table and providing it with the TileDB location. There is then a security
387-
check to ensure that the user is able to read the file that they've asked the API
388-
to register. This is achieved by asking the user to provide a "SecretToken"
389-
which must also be present in the the TileDB array metadata. omero2pandas will
390-
manage the creation of this token automatically. When using omero2pandas this
391-
process also implicitly confirms that the table seen by the server is the same
392-
one written by this library.
382+
# At this point you could copy the tiledb file to the server
383+
384+
# Register the table remotely
385+
ann_id = register_table(omero_connector, "/server/path/to/my.tiledb",
386+
table_name="My table", links=[("Image", 101)],
387+
token=secret_token)
388+
```
393389

394390
While it is possible to manually create and register tables without a `SecretToken`,
395391
this is strongly discouraged as other users could potentially register and access
396392
the same table without permission. With that in mind the implementation within
397393
omero2pandas could be considered as an example of "best practice" for handling
398394
remote table registration.
399-
400-
If the registration succeeds the tables API will create all the necessary OMERO
401-
objects and return a FileAnnotation ID just as if we'd uploaded the table normally.
402-
403-
#### Converting to TileDB format without registration
404-
405-
While the processes of tiledb conversion and remote registration are intended to
406-
be used together, it is possible to only convert a table to an OMERO Plus-compatible
407-
TileDB file. This can be achieved as follows:
408-
409-
```python
410-
import pandas as pd
411-
from omero2pandas.remote import create_tiledb
412-
df = pd.read_csv("/path/to/table.csv")
413-
secret_token = create_tiledb(df, "/path/to/output.tiledb")
414-
```
415-
416-
This will convert an input dataframe of csv file path into a TileDB file with
417-
appropriate metadata for remote registration.
418-
419-
For convenience the creation function will return the SecretToken needed to perform
420-
remote registration securely. That token could also be retrieved from the TileDB
421-
file metadata if necessary.

0 commit comments

Comments
 (0)