Command line tool for monitoring changes of File entities scoped in a Synapse File View

Overview

Synapse Monitoring

Get synapsemonitor from PyPI

Provides tools for monitoring and keeping track of File entity changes in Synapse with the use of File Views. Learn more about File Views

Installation

pip install synapsemonitor

Monitor Fileview and send email notifications

Monitors a project or entities provided in the scope of a File View for changes and sends an email through the Synapse messaging system to the user specified when changes have been made to the project. Includes a list of changed files. Please see Create File View if you do not have a File View.

usage: synapsemonitor view [-h] [--user_ids USER_IDS [USER_IDS ...]]
                           [--output OUTPUT] [--email_subject EMAIL_SUBJECT]
                           [--days days]
                           id

positional arguments:
  id                    Synapse ID of fileview to be monitored.

optional arguments:
  -h, --help            show this help message and exit
  --user_ids USER_IDS [USER_IDS ...]
                        User Id of individuals to send report. If not
                        specified will defaults to logged in Synapse user.
  --output OUTPUT       Output modified entities into this csv file.
  --email_subject EMAIL_SUBJECT
                        Sets the subject heading of the email sent
                        out.(default: New Synapse Files)
  --days days, -d days  Find modifications to entities in the last N
                        days.(default: 1)

Create File View

Creates a file view that will list all the File entities under the specified scopes (Synapse Folders or Projects). This will allow you to query for the files contained in your specified scopes. This will NOT track the other entities currently: PROJECT, TABLE, FOLDER, VIEW, DOCKER.

synapsemonitor create-file-view -h
usage: synapsemonitor create-file-view [-h] --scope_ids SCOPE_IDS
                                       [SCOPE_IDS ...]
                                       NAME project_id

positional arguments:
  NAME                  File View name
  project_id            Synapse Project Id to store file view in

optional arguments:
  -h, --help            show this help message and exit
  --scope_ids SCOPE_IDS [SCOPE_IDS ...]
                        Synapse Folder / Project Ids
Comments
  • monitor a single file entity

    monitor a single file entity

    Fixes #24 Fixes #42

    • Monitors a single file entity
    • Removes File from not implemented list in tests
    • Add Schema in addition to File as valid single entity types for monitoring
    opened by hhunterzinck 7
  • Add monitoring of entities scoped under a fileview for the last X days

    Add monitoring of entities scoped under a fileview for the last X days

    • Creates synapsemonitor monitor cli command
    • Monitors a single Synapse project/entities scoped in a fileview for changes. Will notify users for any files that were added or updated in the past X number of days.

    Motivate users to use file views if there is a desire to track files from many projects.

    opened by thomasyu888 7
  • allow user to specify time unit

    allow user to specify time unit

    Fixes #25

    Allow user to specify value of time in the past to search for modified entities in days, hours, or minutes:

    major changes

    • adapt CLI to specify value and unit (default is still 1 day)
    • adapt function parameters for value and unit input
    • adapt detection of modified entities in a fileview and from the entity modifiedOn timestamp to time unit
    • new tests for detecting changes by hour and minute

    other changes

    • use datetime.utcnow() to get current time in UTC directly
    opened by hhunterzinck 4
  • monitor containers for modified entities

    monitor containers for modified entities

    Fixes #23

    • added _traverse: traversal function that returns any descendants of a given entity type (retained to enhance later functionality)
    • implemented _find_modified_entities_container: checks container and descendants for modification
    • removed test for unimplemented functions
    • added tests in TestModifiedContainer class
    opened by hhunterzinck 2
  • Remove create-file-view command functionality?

    Remove create-file-view command functionality?

    Is this worth retaining and maintaining if single entities and containers can be monitored? For efficiency in monitoring a large container's contents, synapsemonitor could create a temporary project and file view under the hood instead of making the user to create one in a separate command.

    opened by hhunterzinck 2
  • Add monitoring of team members

    Add monitoring of team members

    1. Create (if doesn't exist)/get Synapse Table to track team members
    2. Get current list of team members
    3. Compare current list with Synapse Table
    4. email user when there are new members
    opened by thomasyu888 1
  • Add CodeQL workflow for GitHub code scanning

    Add CodeQL workflow for GitHub code scanning

    Hi Sage-Bionetworks/synapsemonitor!

    This is a one-off automatically generated pull request from LGTM.com :robot:. You might have heard that we’ve integrated LGTM’s underlying CodeQL analysis engine natively into GitHub. The result is GitHub code scanning!

    With LGTM fully integrated into code scanning, we are focused on improving CodeQL within the native GitHub code scanning experience. In order to take advantage of current and future improvements to our analysis capabilities, we suggest you enable code scanning on your repository. Please take a look at our blog post for more information.

    This pull request enables code scanning by adding an auto-generated codeql.yml workflow file for GitHub Actions to your repository — take a look! We tested it before opening this pull request, so all should be working :heavy_check_mark:. In fact, you might already have seen some alerts appear on this pull request!

    Where needed and if possible, we’ve adjusted the configuration to the needs of your particular repository. But of course, you should feel free to tweak it further! Check this page for detailed documentation.

    Questions? Check out the FAQ below!

    FAQ

    Click here to expand the FAQ section

    How often will the code scanning analysis run?

    By default, code scanning will trigger a scan with the CodeQL engine on the following events:

    • On every pull request — to flag up potential security problems for you to investigate before merging a PR.
    • On every push to your default branch and other protected branches — this keeps the analysis results on your repository’s Security tab up to date.
    • Once a week at a fixed time — to make sure you benefit from the latest updated security analysis even when no code was committed or PRs were opened.

    What will this cost?

    Nothing! The CodeQL engine will run inside GitHub Actions, making use of your unlimited free compute minutes for public repositories.

    What types of problems does CodeQL find?

    The CodeQL engine that powers GitHub code scanning is the exact same engine that powers LGTM.com. The exact set of rules has been tweaked slightly, but you should see almost exactly the same types of alerts as you were used to on LGTM.com: we’ve enabled the security-and-quality query suite for you.

    How do I upgrade my CodeQL engine?

    No need! New versions of the CodeQL analysis are constantly deployed on GitHub.com; your repository will automatically benefit from the most recently released version.

    The analysis doesn’t seem to be working

    If you get an error in GitHub Actions that indicates that CodeQL wasn’t able to analyze your code, please follow the instructions here to debug the analysis.

    How do I disable LGTM.com?

    If you have LGTM’s automatic pull request analysis enabled, then you can follow these steps to disable the LGTM pull request analysis. You don’t actually need to remove your repository from LGTM.com; it will automatically be removed in the next few months as part of the deprecation of LGTM.com (more info here).

    Which source code hosting platforms does code scanning support?

    GitHub code scanning is deeply integrated within GitHub itself. If you’d like to scan source code that is hosted elsewhere, we suggest that you create a mirror of that code on GitHub.

    How do I know this PR is legitimate?

    This PR is filed by the official LGTM.com GitHub App, in line with the deprecation timeline that was announced on the official GitHub Blog. The proposed GitHub Action workflow uses the official open source GitHub CodeQL Action. If you have any other questions or concerns, please join the discussion here in the official GitHub community!

    I have another question / how do I get in touch?

    Please join the discussion here to ask further questions and send us suggestions!

    opened by lgtm-com[bot] 0
  • Modify rate specification to ensure compatibility with scheduled job products

    Modify rate specification to ensure compatibility with scheduled job products

    The scheduled job product in the Sage Service Catalog does not allow for a space in a parameters in the command line (see ticket). So the way the rate is specified needs to changed to remove any requirement for a space in a string.

    Some alternatives:

    1. Specify like 1h or 1d for 1 hour or 1 day
    2. Two parameter specification of the rate --unit {hour,day} --value {#}

    I have a preference for option 2 from a user standpoint as all of the information required will be within the command line help. For 1, the user would have to have some a priori knowledge of industry standards or have to read the documentation outside of the command line help.

    opened by hhunterzinck 0
  • Pdoc3 - auto validation

    Pdoc3 - auto validation

    Add auto documentation - will improve over time. This Github action does several steps whenever there is a push to the develop branch:

    • It uses pdoc3 and creates the documentation
    • Pushes the changes to thegh-pages branch
    • The gh-pages branch has a index.html
    opened by thomasyu888 0
  • expand synapse login functionality to accept secrets

    expand synapse login functionality to accept secrets

    Fixes #58

    synapse login function now searches for synapse credentials in the following order:

    1. SCHEDULED_JOB_SECRETS (+ json parsing for SYNAPSE_AUTH_TOKEN)
    2. SYNAPSE_AUTH_TOKEN
    3. config file path from function argument
    opened by hhunterzinck 0
  • Expand Synapse login options for service catalog scheduled jobs

    Expand Synapse login options for service catalog scheduled jobs

    Service Catalog scheduled jobs require Synapse PAT to be passed as a SECRET and extracted from an environmental variable in JSON format:

    https://sagebionetworks.jira.com/wiki/spaces/SC/pages/938836322/Service+Catalog+Provisioning#Passing-Synapse-access-token-as-a-secret-using-environment-variables%3A

    Will probably have to modify the synapse_login() function: https://github.com/Sage-Bionetworks/synapsemonitor/blob/ab78f60e1809a28221dd8d945c9b7a5c4bdc4a95/synapsemonitor/main.py#L136

    Login should probably follow synapseclient default order of precedence for accessing credentials: https://python-docs.synapse.org/build/html/index.html#synapseclient.Synapse.login

    1. Check first for SYNAPSE_AUTH_TOKEN
    2. Check for SCHEDULED_JOB_SECRETS and parse to get SYNAPSE_AUTH_TOKEN value
    3. Check for existence of .synapseConfig file from specified path in function argument
    opened by hhunterzinck 0
  • Bump certifi from 2021.10.8 to 2022.12.7

    Bump certifi from 2021.10.8 to 2022.12.7

    Bumps certifi from 2021.10.8 to 2022.12.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Add functionality to return parent folder that has files been modified

    Add functionality to return parent folder that has files been modified

    I'm not sure if there is a functionality already, but I found if I create a fileview and only include folder in its scope. The view is not changing the modifiedOn value when a file is updated/uploaded to the scoped folders but it is changing when a subfolder is added. If we are using files in the view scope, the modifiedOn value reflects the most recent changes but would send us hundreds of SynIDs that would be less informative than only giving us the folders that have content changed.

    opened by danlu1 11
  • Add functionality to notify members of a team

    Add functionality to notify members of a team

    Currently, synapsemonitor accepts a list of individual Synapse users to notify. The user should also be able to specify a team name in order to notify all members of the team that an entity has been modified.

    opened by hhunterzinck 0
  • Add functionality to traverse more entity types

    Add functionality to traverse more entity types

    Currently, the _traverse function is limited to collecting file, folder, and project entity types. Full list for getChildren includes ['folder', 'file', 'table', 'link', 'entityview', 'dockerrepo']. And there are probably other missing types here like 'datasets'.

    Implementation would require a full mapping between the entity 'concreteType' and the getChildren 'includeTypes' strings.

    'org.sagebionetworks.repo.model.FileEntity' --> 'file' 'org.sagebionetworks.repo.model.Folder' --> 'folder' 'org.sagebionetworks.repo.model.Project' --> 'project' 'org.sagebionetworks.repo.model.table.EntityView' --> 'entityview' 'org.sagebionetworks.repo.model.table.TableEntity' --> 'table' 'org.sagebionetworks.repo.model.Link' --> 'link' ? --> 'dockerrepo'

    opened by hhunterzinck 0
Releases(v1.1.0)
  • v1.1.0(Jun 9, 2022)

    What's Changed

    • modify rate parameter by @hhunterzinck in https://github.com/Sage-Bionetworks/synapsemonitor/pull/69
    • V1.1.0 rc by @thomasyu888 in https://github.com/Sage-Bionetworks/synapsemonitor/pull/70

    Full Changelog: https://github.com/Sage-Bionetworks/synapsemonitor/compare/v1.0.0...v1.1.0

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Apr 19, 2022)

    What's Changed

    • allow user to specify time unit by @hhunterzinck in https://github.com/Sage-Bionetworks/synapsemonitor/pull/65

    Full Changelog: https://github.com/Sage-Bionetworks/synapsemonitor/compare/v0.0.3...v1.0.0

    Source code(tar.gz)
    Source code(zip)
  • v0.0.3(Feb 21, 2022)

    What's Changed

    • Add setupcfg by @thomasyu888 in https://github.com/Sage-Bionetworks/synapsemonitor/pull/20
    • lint by @thomasyu888 in https://github.com/Sage-Bionetworks/synapsemonitor/pull/21
    • Add empty functions to support other types other than file views by @thomasyu888 in https://github.com/Sage-Bionetworks/synapsemonitor/pull/22
    • Move old scripts outside of the package by @thomasyu888 in https://github.com/Sage-Bionetworks/synapsemonitor/pull/31
    • Add contribution guide by @thomasyu888 in https://github.com/Sage-Bionetworks/synapsemonitor/pull/19
    • Add in information on using Docker + cronjob by @thomasyu888 in https://github.com/Sage-Bionetworks/synapsemonitor/pull/29
    • Return list of synapse ids instead of dataframe by @thomasyu888 in https://github.com/Sage-Bionetworks/synapsemonitor/pull/32
    • add verbosity control by @hhunterzinck in https://github.com/Sage-Bionetworks/synapsemonitor/pull/35
    • use logger to control output by @hhunterzinck in https://github.com/Sage-Bionetworks/synapsemonitor/pull/39
    • fix writing to csv and log printing by @hhunterzinck in https://github.com/Sage-Bionetworks/synapsemonitor/pull/40
    • minor reformats to help messages in cli by @hhunterzinck in https://github.com/Sage-Bionetworks/synapsemonitor/pull/47
    • Add base SynapseAction class by @thomasyu888 in https://github.com/Sage-Bionetworks/synapsemonitor/pull/36
    • Add tests for monitoring single entity by @thomasyu888 in https://github.com/Sage-Bionetworks/synapsemonitor/pull/49
    • monitor a single file entity by @hhunterzinck in https://github.com/Sage-Bionetworks/synapsemonitor/pull/41
    • monitor containers for modified entities by @hhunterzinck in https://github.com/Sage-Bionetworks/synapsemonitor/pull/51
    • update create parser and printing by @hhunterzinck in https://github.com/Sage-Bionetworks/synapsemonitor/pull/56
    • update readme by @hhunterzinck in https://github.com/Sage-Bionetworks/synapsemonitor/pull/57
    • expand synapse login functionality to accept secrets by @hhunterzinck in https://github.com/Sage-Bionetworks/synapsemonitor/pull/59
    • Add code of conduct by @thomasyu888 in https://github.com/Sage-Bionetworks/synapsemonitor/pull/61
    • Pdoc3 - auto doc generation by @thomasyu888 in https://github.com/Sage-Bionetworks/synapsemonitor/pull/60

    New Contributors

    • @hhunterzinck made their first contribution in https://github.com/Sage-Bionetworks/synapsemonitor/pull/35

    Full Changelog: https://github.com/Sage-Bionetworks/synapsemonitor/compare/v0.0.2...v0.0.3

    Source code(tar.gz)
    Source code(zip)
  • v0.0.2(Jul 30, 2021)

  • v0.0.1(Feb 2, 2021)

Owner
Sage Bionetworks
Sage Bionetworks
CPOST is a CLI tool to assist with the proper sizing of Clara Deploy pipelines

CPOST (Clara Pipeline Operator Sizing Tool) Tool to measure resource usage of Clara Platform pipeline operators Cpost is a tool that will help you run

NVIDIA Corporation 5 Sep 27, 2021
Key-control - A tool for add keys to your Termux app

Key-Control Is a tool for add keys to your Termux app. Cara Penginstalan $ pkg u

Beereva.id 1 Feb 14, 2022
command line interface to manage VALORANT skins

A PROPER RELEASE IS COMING SOON, IF YOU KNOW HOW TO USE PYTHON YOU CAN USE IT NOW! valorant skin manager command line interface simple command line in

colinh 131 Dec 25, 2022
telescope.nvim is a highly extendable fuzzy finder over lists.

telescope.nvim is a highly extendable fuzzy finder over lists. Built on the latest awesome features from neovim core. Telescope is centered around modularity, allowing for easy customization.

nvim-telescope 8.4k Jan 05, 2023
A Python script for finding a food-truck based on latitude and longitude coordinates that you can run in your shell

Food Truck Finder Project Description This repository contains a Python script for finding a food-truck based on latitude and longitude coordinates th

1 Jan 22, 2022
Generate an ASCII Art from keyword put in the cli

ascii-art-generator-cli Generate an ASCII Art from keyword put in the cli Install git clone https://github.com/Nathanlauga/ascii-art-generator-cli cd

Nathan Lauga 1 Nov 14, 2021
CLI utility for updating the EVE Online static data export in a postgres database

EVE SDE Postgres updater CLI utility for updating the EVE Online static data export postgres database. This has been tested with the Fuzzwork postgres

Markus Juopperi 1 Oct 29, 2021
Postgres CLI with autocompletion and syntax highlighting

A REPL for Postgres This is a postgres client that does auto-completion and syntax highlighting. Home Page: http://pgcli.com MySQL Equivalent: http://

dbcli 10.8k Jan 02, 2023
Professor Wordlist is a free open source command line tool written in python

Professor Wordlist is a free open source command line tool written in python, With the aim of generating custom wordlists with a variety of unique parameters and functions providing many possibilitie

オークO A K Z E H オーク 1 Oct 28, 2021
Powerful yet easy command line calculator.

Powerful yet easy command line calculator.

Cruisen 1 Jul 22, 2022
Unpacks things.

$ unp_ unp is a command line tool that can unpack archives easily. It mainly acts as a wrapper around other shell tools that you can find on v

Armin Ronacher 405 Jan 03, 2023
Rich is a Python library for rich text and beautiful formatting in the terminal.

The Rich API makes it easy to add color and style to terminal output. Rich can also render pretty tables, progress bars, markdown, syntax highlighted source code, tracebacks, and more — out of the bo

Will McGugan 41.4k Jan 03, 2023
A simple and easy-to-use CLI parse tool.

A simple and easy-to-use CLI parse tool.

AbsentM 1 Mar 04, 2022
Sink is a CLI tool that allows users to synchronize their local folders to their Google Drives. It is similar to the Git CLI and allows fast and reliable syncs with the drive.

Sink is a CLI synchronisation tool that enables a user to synchronise local system files and folders with their Google Drives. It follows a git C

Yash Thakre 16 May 29, 2022
open a remote repo locally quickly

A command line tool to peek a remote repo hosted on github or gitlab locally and view it in your favorite editor. The tool handles cleanup of the repo once you exit your editor.

Rahul Nair 44 Dec 16, 2022
CLI tool for typescript tasks & migrations

typed CLI tool for typescript tasks & migrations Installation Usage $ typed --list Subcommands: bootstrap 🔨 Bootstrap your environment for TypeS

Lob 1 Nov 15, 2021
🎈 `st` is a CLI to quickly kick-off your new Streamlit project

🎈 st - a friendly Streamlit CLI st is a CLI that helps you kick-off a new Streamlit project so you can start crafting the app as soon as possible! Ho

Arnaud 18 Dec 19, 2022
Command-line script to upload videos to Youtube using theYoutube APIv3.

Introduction Command-line script to upload videos to Youtube using theYoutube APIv3. It should work on any platform (GNU/Linux, BSD, OS X, Windows, ..

Arnau Sanchez 1.9k Jan 09, 2023
LSD (Linux Spotify Downloader) is a command line tool for downloading or rather recording content on Spotify.

LSD (Linux Spotify Downloader) is a command line tool for downloading or rather recording content on Spotify.

Jannis Zahn 7 Jun 21, 2022
Program Command Line Interface (CLI) Sederhana: Pemesanan Nasi Goreng Hekel

Program ini merupakan aplikasi yang berjalan di dalam command line (terminal). Program ini menggunakan built-in library python yaitu argparse yang dapat menerima parameter saat program ini dijalankan

Habib Abdurrasyid 5 Nov 19, 2021