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
The project help you to quickly build layouts in terminal,cross-platform

The project help you to quickly build layouts in terminal,cross-platform

gojuukaze 133 Nov 30, 2022
Tablicate - Python library for easy table creation and output to terminal

Tablicate Tablicate - Python library for easy table creation and output to terminal Features Column-wise justification alignment (left, right, center)

3 Dec 14, 2022
argofloats: Simple CLI for ArgoVis and Argofloats

argofloats: Simple CLI for ArgoVis and Argofloats Argo is an international program that collects information from inside the ocean using a fleet of ro

Samapriya Roy 2 Feb 13, 2022
Python Library and CLI for exporting MySQL databases

expdb Python library and CLI for exporting MySQL databases Installation Pre-requisites MySQL server Python 3.9+ Using git Clone the repository to your

Devansh Singh 1 Nov 29, 2021
Command-line parsing library for Python 3.

Command-line parsing library for Python 3.

36 Dec 15, 2022
Access hacksec.in from your command-line

Access hacksec.in from your command-line

hacksec.in 3 Oct 26, 2022
🌈 Lightweight Python package that makes it easy and fast to print terminal messages in colors. 🌈

🌈 Colorist for Python 🌈 Lightweight Python package that makes it easy and fast to print terminal messages in colors. Prerequisites Python 3.9 or hig

Jakob Bagterp 1 Feb 05, 2022
Lets you view, edit and execute Jupyter Notebooks in the terminal.

Lets you view, edit and execute Jupyter Notebooks in the terminal.

David Brochart 684 Dec 28, 2022
A command line tool (and Python library) for archiving Twitter JSON

A command line tool (and Python library) for archiving Twitter JSON

Documenting the Now 1.3k Dec 28, 2022
Run an FFmpeg command and see the percentage progress and ETA.

Run an FFmpeg command and see the percentage progress and ETA.

25 Dec 22, 2022
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
🦎 A NeoVim plugin for highlighting visual selections like in a normal document editor!

🦎 HighStr.nvim A NeoVim plugin for highlighting visual selections like in a normal document editor! Demo TL;DR HighStr.nvim is a NeoVim plugin writte

Pocco81 222 Jan 03, 2023
[WIP]An ani-cli like cli tool for movies and webseries

mov-cli A cli to browse and watch movies. Installation This project is a work in progress. However, you can try it out python git clone https://github

166 Dec 30, 2022
Free and Open-Source Command Line tool for Text Replacement

Sniplet Free and Open Source Text Replacement Tool Description: Sniplet is a work in progress CLI tool which can do text replacement globally in Linux

Veeraraghavan Narasimhan 13 Nov 28, 2022
Freaky fast fuzzy Denite/CtrlP matcher for vim/neovim

Freaky fast fuzzy Denite/CtrlP matcher for vim/neovim This is a matcher plugin for denite.nvim and CtrlP.

Raghu 113 Sep 29, 2022
Example of a CLI with python - know the extension of your files.

extensionCLI Example of a CLI with python - know the extension of your files. Usage: Install the CLI: pip3 install -e . Run the command with "ext" + t

ItanuRomero 5 Dec 29, 2022
Borderless-Window-Utility - Modifies window style to force most applications into a borderless windowed mode

Borderless-Window-Utility Modifies window style to force most applications into

8 Oct 22, 2022
A simple CLI to convert snapshots into EAVT log, and EAVT log into SCD.

EAVT helper CLI Simple CLI to convert snapshots into eavt log, and eavt log into slowly changing dimensions Usage Installation Snapshot to EAVT log EA

2 Apr 07, 2022
Commandline Python app to Autodownload mediafire folders and files.

Commandline Python app to Autodownload mediafire folders and files.

Tharuk Renuja 3 May 12, 2022
WazirX Portfolio Tracker on your Terminal!

If you have been investing in crypto in India, there is a very good chance that you are using WazirX. If you are using WazirX, then you definitely know that there is no P&L report, no green arrows no

Raunit 15 Jan 10, 2022