Metadata-Version: 2.4
Name: omero_quay
Version: 1.4.0
Summary: Omero Data Import Export Queue
Project-URL: Homepage, https://gitlab.in2p3.fr/fbi-data/omero-quay
Project-URL: Bug Tracker, https://gitlab.in2p3.fr/fbi-data/omero-quay/issues
Project-URL: Discussions, https://gitlab.in2p3.fr/fbi-data/omero-quay/discussions
Project-URL: Changelog, https://gitlab.in2p3.fr/fbi-data/omero-quay/releases
Author-email: Guillaume Gay <guillaume.gay@france-bioimaging.org>
License-Expression: MPL-2.0
License-File: LICENSE
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
Requires-Python: <3.13,>=3.10
Requires-Dist: aicsimageio
Requires-Dist: clamav-client
Requires-Dist: ezomero
Requires-Dist: ffmpeg
Requires-Dist: imageio
Requires-Dist: jinja2
Requires-Dist: linkml-runtime
Requires-Dist: odfpy
Requires-Dist: omero-cli-transfer
Requires-Dist: omero-py
Requires-Dist: openpyxl
Requires-Dist: pandas
Requires-Dist: pillow
Requires-Dist: pyarrow
Requires-Dist: python-irodsclient
Requires-Dist: python-magic
Requires-Dist: requests
Requires-Dist: roc-validator
Requires-Dist: scikit-image
Requires-Dist: xlsxwriter
Requires-Dist: xsdata
Provides-Extra: server
Requires-Dist: motor; extra == 'server'
Requires-Dist: pymongo; extra == 'server'
Requires-Dist: pyzmq; extra == 'server'
Requires-Dist: tornado; extra == 'server'
Requires-Dist: zeroc-ice==3.6.5; extra == 'server'
Description-Content-Type: text/markdown

# omero-quay

[![Actions Status][actions-badge]][actions-link]
[![Documentation Status][rtd-badge]][rtd-link]

[![PyPI version][pypi-version]][pypi-link]
[![PyPI platforms][pypi-platforms]][pypi-link]

<!-- prettier-ignore-start -->
[actions-link]:             https://gitlab.in2p3.fr/fbi-data/omero-quay/badges/main/pipeline.svg
[pypi-link]:                https://pypi.org/project/omero-quay/
[pypi-platforms]:           https://img.shields.io/pypi/pyversions/omero-quay
[pypi-version]:             https://img.shields.io/pypi/v/omero-quay
[rtd-badge]:                https://readthedocs.org/projects/omero-quay/badge/?version=latest
[rtd-link]:                 https://omero-quay.readthedocs.io/en/latest/?badge=latest
<!-- prettier-ignore-end -->

`omero-quay` is a microscopy data transport layer between data management tools.

Currently, it supports the [iRODS](https://irods.org) —
[OMERO](https://openmicroscopy.org/omero) architecture built at France
BioImaging [fbi-omero](https://gitlab.in2p3.fr/fbi-data/fbi-omero).

![omero-quay orchestrate data transport between iRODS and OMERO](docs/services-architecture.svg)

## Objectives

- Interact with data management tools APIs
- Trigger actions:
  - Create / Read / Update / Delete
  - Transport / Import
- Synch databases :warning:

## Schema driven development

- [`manifest.yml`](src/schema/manifest-schema.yml) defines the data schema in
  LinkML
- follows an Investigation Study Assay hierarchy
- maps APIs, objects ids, ACLs
- **only transports "crates", not individual files**

### Generate the pydantic classes:

```sh
gen-pydantic src/omero_quay/schema/manifest-schema.yml --template-dir=src/omero_quay/templates  > src/omero_quay/core/manifest.py
```

## ZeroMQ

![](docs/message_flows.svg){ width="70%" }

- Message = json dump of a `manifest` instance
- Central brocker routes messages based on **state**

## Example route:

![](docs/import_route.svg){ width="60%" }

# Install

This is early stage and only meant for developers.

For now, install from source.

1. Get and install a `conda` distribution. We prefer
   [miniconda](https://www.anaconda.com/docs/getting-started/miniconda/main)
2. Download omero-quay from this repository (as an archive or with git)
3. In the `omero-quay` directory:

```bash
# create and activate the conda environment
conda env create -f environment.yml
conda activate quay

# install omero-quay in editable mode
uv pip install -e .
# install dev dependencies
uv pip install --group dev
# OPTIONAL : if you want to run notabook with Euporie
# the notebook group will automatically install dev dependencies
uv pip install --group notebook
python -m ipykernel install --user
```

For now, this software alone is not very useful, and works only within the
`omero-fbi` frameworks. Work on setting up a `docker compose` view of this
format is in the works. Look into the [`tests`](tests) folder for examples.

# Configuration

The configuration is described in [quay.yml](src/omero-quay/core/quay.yml). On
the client or server machine, adapt this file and copy it to
`/home/user/.config/quay.yml`

In `/etc/docker`, add a file called "daemon.json", and copy these tunings
inside:

```
{
  "default-ulimits": {
    "nofile": {
      "Name": "nofile",
      "Hard": 10000,
      "Soft": 10000
    },
    "nproc": {
      "Name": "nproc",
      "Hard": 10000,
      "Soft": 10000
    }
  }
}
```

This is to prevent the "Too many open files" eventual errors. More details about
that here: `https://thelinuxcode.com/set-docker-ulimits/`

# Usage

## Remote client

### Install

- Install omero-quay (see above)
- add irods server IP to /etc/hosts
- Write the client configuration file and save it to `$HOME/.config/quay.yml`

```yaml
---
irods:
  # This is the configuration for Montpellier
  IRODS_HOST: irods-mtp.omero-fbi.fr
ingest:
  POST_URL: https://mtp.omero-fbi.fr/post
```

### Import data

(all paths below are relative to the omero-quay root directory where this
`README` file resides)

- Put an excel file with the relevant data at the root of the directory you want
  to import

- Run the import client (make sure the `quay` environment is activated):

```sh

python scripts/desktop_cli.py other/path/to/your.xlsx path_in_irods
```

## Service

On the OMERO server machine:

```sh
python scripts/run_service.py
```

## Excel client

On a client machine

```sh
python scripts/excel_import.py
```

## Autoingest with iRODS

TODO

# Tests

In order to run tests, you need to boot up docker containers for the omero
server, irods catalog provider and nfsrods.

This is achieved by running `up.sh` script in `tests/docker`

```sh
cd tests/docker
./up.sh

```

After some minutes and possible connection retries, you should have the
containers running.

You can then run the tests from the root of the repo with `pytest`

# TEST INSTALL DEV

## WINDOWS WSL

### installation from a fresh WSL

clone omero_quay (create a token under Setting if needed, use your in2P gitlab
credential username using the token as password)

install docker following https://docs.docker.com/engine/install/debian/
https://docs.docker.com/engine/install/linux-postinstall/

install make : sudo apt install make

###

```sh
cd omero_quay
cp tests/containers/example.env tests/containers/.env
```

EDIT the .env file to replace TAG from local to dev: `TAG=dev`

```sh
make docker_pull
./tests/containers/get_test_data.sh
make docker_up
make docker_populate
export QUAY_TEST_DATA="/mnt/c/Users/paul-gilloteaux-p/Documents/GitHub/omero-quay/QuayTestData"
make nbtest
```

The path for QUAY_TEST_DATA should be modified to your own path.

your dev env should be up and accessible from localhost:4080

to look at the logs of the test notebook (nbtest), in another console: `make
omero_logs

NB: If you did your gitclone from Windows and not wsl, sudo dos2unix all scripts

### to restart the dev env once installed

```sh
make docker_purge
make docker_up
make docker_populate
export QUAY_TEST_DATA="/mnt/c/Users/paul-gilloteaux-p/Documents/GitHub/omero-quay/QuayTestData"
make nbtest
```

### To restart Omero-web when debugging

```sh
cd tests/containers
docker compose restart omero-web
```
