Skip to content
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

Pull development into main ahead of tagged release #62

Merged
merged 48 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
e5bc323
Renamed test_run
nmassey001 Jan 25, 2023
ee3b04c
Merge branch 'development' into tags
nmassey001 Feb 2, 2023
8c49229
Refactor retries into separate class
jackleland Feb 2, 2023
e3f6691
Finish refactor of Retries and add dictionary conversion
jackleland Feb 3, 2023
d6b0bb6
Update details unit tests to reflect recent refactor
jackleland Feb 3, 2023
d47d67a
Fix Retries refactor in multiple places
jackleland Feb 3, 2023
095a615
Merge branch 'development' into tags
nmassey001 Feb 6, 2023
7e6c323
Fixed badly formatted output string
nmassey001 Feb 8, 2023
695e09a
Add tags to PUT and alter / add tags using meta command
nmassey001 Feb 8, 2023
78002eb
Add a General section to the server config
jackleland Feb 9, 2023
3ff14eb
Fix typo in publisher general config logic
jackleland Feb 9, 2023
09a1c8d
Fix typo in successful response strings
jackleland Feb 9, 2023
ff44758
Add retries section strings and rename RETRY_COUNT
jackleland Feb 10, 2023
bb9de4c
Add Transaction-level Retries into Workflow
jackleland Feb 10, 2023
c848dae
Update pytest fixture message to reflect new Retries section
jackleland Feb 10, 2023
c6379cc
Add a bespoke CallbackError exception for triggering a retry
jackleland Feb 10, 2023
452dedc
Fix perpetual routing on non-existent holding request
jackleland Feb 10, 2023
d914f54
Fix typo in callback error
jackleland Feb 10, 2023
e4bc3f9
Added warning to monitor db
nmassey001 Feb 13, 2023
dbec9aa
Added warning to messages
nmassey001 Feb 13, 2023
710ea20
Removed unneeded imports
nmassey001 Feb 13, 2023
3706653
Tidied up tag processing
nmassey001 Feb 13, 2023
3a5b264
Added deltag support
nmassey001 Feb 13, 2023
c782ec7
Search on tags and del tag
nmassey001 Feb 13, 2023
6228d53
Added warning for monitor
nmassey001 Feb 13, 2023
a407094
Added whitespace
nmassey001 Feb 13, 2023
282576c
Put the logger back in
nmassey001 Feb 13, 2023
75510e0
Merge conflict resolved
nmassey001 Feb 13, 2023
f3485f6
Update to docs with instructions for setting up a cta emulator
jackleland Feb 14, 2023
bf176a2
Fix minor typo and leftover print statement
jackleland Feb 14, 2023
f744618
Merge pull request #59 from cedadev/tags
jackleland Feb 14, 2023
a5d6f5a
Add in-progress doc page on server config
jackleland Feb 14, 2023
e004288
Further updates to server config docs
jackleland Feb 15, 2023
dfd066a
Add ceda logo to docs
jackleland Feb 15, 2023
e224cf2
Finish all sections for the server config docs
jackleland Feb 24, 2023
f2e2026
Reorganise server config docs and add example
jackleland Feb 24, 2023
63ba50d
Merge pull request #60 from cedadev/docs-update
jackleland Feb 24, 2023
98ae164
Added self.max_retries to constructor
nmassey001 Mar 1, 2023
db2abd0
Made a nicer return information for GET, PUT
nmassey001 Mar 1, 2023
7799d27
Added SIGTERM handling
nmassey001 Mar 7, 2023
40ba2db
Better tag handling
nmassey001 Mar 7, 2023
bc611a6
Removing stripping whitespace from tags
nmassey001 Mar 7, 2023
5523eda
Fixed PUT and PUTLIST hanging on INDEXING when holding_id=a holding i…
nmassey001 Mar 8, 2023
9258533
Make user holding permissions function static
jackleland Mar 9, 2023
c97887e
Add some unit tests for db-mixin, catalog and monitor
jackleland Mar 13, 2023
20bd00b
Fix for modify holding attribute error
jackleland Mar 13, 2023
85f7679
Merge pull request #61 from cedadev/modify-holding-fix
nmassey001 Mar 14, 2023
08049dc
Merge branch 'main' into development
nmassey001 Mar 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/source/ceda.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,10 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ['_static']

html_logo = "ceda.png"
html_theme_options = {
'logo_only': True,
'display_version': False,
}
187 changes: 187 additions & 0 deletions docs/source/cta-emulator.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
CERN Tape Archive Set Up
========================

As part of the development of the NLDS, a tape emulator was set up to better
understand how to interact with ``xrootd`` and the CERN tape archive. The
following instructions detail how to set up such a tape emulator and are adapted
from the instructions on [the CTA repo]
(https://gitlab.cern.ch/cta/CTA/-/tree/main/continuousintegration/buildtree_runner)
and those provided by STFC's Scientific Computing Department at the Rutherford
Appleton Laboratory. There are two major parts: commissioning the virtual
machine, and setting it up appropriately according to the CERN instructions.


Commissioning the VM
--------------------

These instructions are specifically for commissioning a VM on the STFC openstack
cloud interface. For other machines, slightly different instructions will need
to be followed.

After you have logged in to the openstack interface, you click on the "Launch
Instance" button on the top to create the VM and then:

1. In the "Details" tab, give your VM a suitable name
2. In the "Source" tab, select scientificlinux-7-aq as a source image
3. In the "Flavour" tab, select a VM type depending on how many VCPUs, RAM and
disk size you need
4. In the "Networks" tab, select "Internal"
5. In the "Key Pair" tab, upload your public rsa ssh key so you can login to the
VM once it is created.
6. In the "Metadata" tab, click on the pull-down menu "Aquilon Image Properties"
and then set it to "Aquilon Archetype", specifying ``ral-tier1``, and also
"Aquilon Personality" specifying it as ``eoscta_ci_cd``. Note that you will
have to manually write these values out so it's worth copy pasting to avoid
typos!
7. Press the "Launch Instance" button and the VM will be created. Give it some
time so that quattor runs - quattor being a vm management tool like Puppet.
It may also need a reboot at some point.

This setup produces a vm which requires logging in as your openstack username -
in most cases this will be your STFC federal ID. You will be able to sudo
assuming the machine remains in the correct configuration.

**Note:**
The above setup is one that theoretically works. However, the machine which –
after some attempts – successfully had CTA installed on it had to be
commissioned manually by SCD so that

(a) quattor could be made sure to have run successfully and then subsequently
disabled
(b) I would be able to log in as ``root`` thus negating the need to edit the
sudoers file after each reboot.

I would strongly recommend this approach if SCD are agreeable to commissioning
your vm for you.


Setting up CTA on the VM
------------------------

The following are the working set of instructions at time of writing, provided
by SCD at RAL.

* **Ensure quattor is not running**

There should be an empty file at ``/etc/noquattor``, if there is not one then
create it with

``sudo touch /etc/noquattor``

* **Clone the CTA gitlab repo**

``git clone https://gitlab.cern.ch/cta/CTA.git``

* **User environment**

As per instructions

``cd ./CTA/continuousintegration/buildtree_runner/vmBootstrap``

BUT in bootstrapSystem.sh, delete/comment line 46 and then

``./bootstrapSystem.sh``

When prompted for password, press return (i.e don't give one). This creates
the ``cta`` user and adds them to sudoers


* **CTA build tree**

As per instructions

``su - cta``
``cd ~/CTA/continuousintegration/buildtree_runner/vmBootstrap``

BUT edit lines 54,55 in bootstrapCTA.sh to look like

``sudo wget https://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle --no-check-certificate``
``sudo wget https://download.ceph.com/keys/release.asc -O /etc/pki/rpm-gpg/RPM-ASC-KEY-ceph --no-check-certificate``

Note the change in the URL on line 55 from ``git.ceph.com`` to
``download.ceph.com``, as well as the addition of the ``--no-check-certificate``
flag.

Then run bootstrapCTA.sh (without any args)

``./bootstrapCTA.sh``


* **Install MHVTL**

As per instructions

``cd ~/CTA/continuousintegration/buildtree_runner/vmBootstrap``
``./bootstrapMHVTL.sh``

* **Kubernetes setup**

As per instructions

``cd ~/CTA/continuousintegration/buildtree_runner/vmBootstrap``
``./bootstrapKubernetes.sh``

and reboot host

``sudo reboot``

* **Docker image**

Depending on how your machine was set up you may now need to ensure that
quattor is still disabled (i.e. that the ``/etc/noquattor`` file still exists)
and that the cta user is still in the sudoers file. This will not be necessary
if you are running as ``root``.

Then, as per instructions

``su - cta``
``cd ~/CTA/continuousintegration/buildtree_runner``

BUT edit lines 38,39 in /home/cta/CTA/continuousintegration/docker/ctafrontend/cc7/buildtree-stage1-rpms-public/Dockerfile to look like

``RUN wget https://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle --no-check-certificate``
``RUN wget https://download.ceph.com/keys/release.asc -O /etc/pki/rpm-gpg/RPM-ASC-KEY-ceph --no-check-certificate``

then run the master script to prepare all the Docker images.

``./prepareImage.sh``

* **Preparing the environment (MHVTL, kubernetes volumes...)**

As per instructions

``cd ~/CTA/continuousintegration/buildtree_runner``
``sudo ./recreate_buildtree_running_environment.sh``

* **Preparing the CTA instance**

As per instructions

``cd ~/CTA/continuousintegration/orchestration``
``sudo ./create_instance.sh -n cta -b ~ -B CTA-build -O -D -d internal_postgres.yaml``

This may work first time but it never did for me, so the fix is to then run

``./delete_instance.sh -n cta``

To remove the instance and then re-create it with the same command as above
``sudo ./create_instance.sh -n cta -b ~ -B CTA-build -O -D -d internal_postgres.yaml``

This can be verified to be working with a call to

``kubectl -n cta get pods``

which should return a list of the working pods, looking something like:

============ ======== ======== ========= ===
NAME READY STATUS RESTARTS AGE
============ ======== ======== ========= ===
client 1/1 Running 0 35m
ctacli 1/1 Running 0 35m
ctaeos 1/1 Running 0 35m
ctafrontend 1/1 Running 0 35m
kdc 1/1 Running 0 35m
postgres 1/1 Running 0 36m
tpsrv01 2/2 Running 0 35m
tpsrv02 2/2 Running 0 35m
============ ======== ======== ========= ===
12 changes: 10 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@ Welcome to Near-line Data Store's documentation!

.. toctree::
:maxdepth: 2
:caption: Contents:
:caption: Contents

Getting started<home>
Getting started <home>
Specification <specification>
NLDS Server API <nlds-server>
NLDS Processors API <nlds-processors>


.. toctree::
:maxdepth: 2
:caption: Advanced

The server config file <server-config/server-config>
Server config examples <server-config/examples>
Setting up a CTA tape emulator <cta-emulator>


Indices and tables
==================
Expand Down
35 changes: 29 additions & 6 deletions docs/source/nlds-processors.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Core content of the nlds-processors
===================================
Microservices
=============

Core content of the nlds-processors.

The Consumer class
------------------
Expand All @@ -10,21 +12,42 @@ The Consumer class

The processors
--------------
Also referred to as 'microservices'
Also referred to as 'microservices', 'consumers', or 'workers':

.. automodule:: nlds_processors.nlds_worker
:members:

.. automodule:: nlds_processors.index
:members:

.. automodule:: nlds_processors.transfer
.. automodule:: nlds_processors.transferers.base_transfer
:members:

.. automodule:: nlds_processors.transferers.put_transfer
:members:

.. automodule:: nlds_processors.transferers.get_transfer
:members:

.. automodule:: nlds_processors.db_mixin
:members:

.. automodule:: nlds_processors.catalog.catalog_models
:members:

.. automodule:: nlds_processors.catalog.catalog
:members:

.. automodule:: nlds_processors.catalog.catalog_worker
:members:

.. automodule:: nlds_processors.monitor.monitor_models
:members:

.. automodule:: nlds_processors.catalog
.. automodule:: nlds_processors.monitor.monitor
:members:

.. automodule:: nlds_processors.monitor
.. automodule:: nlds_processors.monitor.monitor_worker
:members:

.. automodule:: nlds_processors.logger
Expand Down
8 changes: 5 additions & 3 deletions docs/source/nlds-server.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Core content of the nlds-server
===============================
NLDS API-server
===============

The core content of the NLDS API-server run using FastAPI.

The Publisher class
-------------------
Expand Down Expand Up @@ -28,7 +30,7 @@ The authenticators
:members:
:undoc-members:

Authenicate methods also contains 3 general methods, used by the above 2
Authenticate methods also contains 3 general methods, used by the above 2
modules, to validate the given user, group and token.


Expand Down
Loading