Skip to content

Function handler for write and staging events#39

Open
hailihu wants to merge 6 commits intomasterfrom
write-events-handler
Open

Function handler for write and staging events#39
hailihu wants to merge 6 commits intomasterfrom
write-events-handler

Conversation

@hailihu
Copy link
Copy Markdown
Collaborator

@hailihu hailihu commented Jul 14, 2025

Create a token in PiCaS database when file is written to a dCache directory or staged.
See the advanced example in the README for how to test the functionality.

@hailihu hailihu marked this pull request as draft July 14, 2025 12:25
@hailihu hailihu changed the title Function handler for write events Function handler for write and stage events Jul 16, 2025
@hailihu hailihu marked this pull request as ready for review July 16, 2025 08:51
@hailihu hailihu requested a review from lnauta July 16, 2025 08:52
@hailihu hailihu changed the title Function handler for write and stage events Function handler for write and staging events Jul 16, 2025
@lnauta
Copy link
Copy Markdown
Member

lnauta commented Jul 23, 2025

It's a good first implementation, has all the functionality we look for:

  • create a channel
  • listen to the channel
  • push token on event (from channel)

However, I would like to see more abstraction, where the listening and pushing is somewhere in the package code at picalient/picas

from subprocess import Popen, PIPE, CalledProcessError


def getNextIndex():
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would import getNextIndex if possible

Comment thread README.md
With the following command, a channel named "test_write" is created that will register write events to the specified folder on dCache. Then, if a write event occurs, a token is created in the "todo" view in the PiCaS database.

```
python pushEventsTokens.py --folder /pnfs/grid.sara.nl/data/users/username/tape/testdir --tokenfile tokenfile.conf --event write --api https://dcacheview.grid.surfsara.nl:22880/api/v1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using a disk path is probably more reliable for an example (in case a user goes and tries it)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specify that username in the path is an example

Comment thread README.md
The file should have status "NEARLINE" (ond not "ONLINE_AND_NEARLINE"). If so, stage this file with:

```
ada --tokenfile tokenfile.conf --stage /pnfs/grid.sara.nl/data/users/hailih/tape/testfile --api https://dcacheview.grid.surfsara.nl:22880/api/v1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove username

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants