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
Chat In Terminal - Chat-App in python

Chat In Terminal Hello all. 😉 Sockets and servers are vey important for connection and importantly chatting with others. 😂 😁 I have thought of maki

Shreejan Dolai 5 Nov 17, 2022
Openstack bucket retention cli

Openstack bucket retention cli

Fatih Sarhan 3 Apr 03, 2022
Shazam is a Command Line Application that checks the integrity of the file by comparing it with a given hash.

SHAZAM - Check the file's integrity Shazam is a Command Line Application that checks the integrity of the file by comparing it with a given hash. Crea

Anaxímeno Brito 1 Aug 21, 2022
QueraToCSV is a simple python CLI project to convert the Quera results file into CSV files.

Quera is an Iranian Learning management system (LMS) that has an online judge for programming languages. Some Iranian universities use it to automate the evaluation of programming assignments.

Amirmahdi Namjoo 16 Nov 11, 2022
Task-manager-CLI with Priority Modification

Task-manager-CLI with Priority Modification The functions for the app have been written in task.py file. 1. Install Node.js This project requires Node

1 Jan 21, 2022
pyNPS - A cli Linux and Windows Nopaystation client made with python 3 and wget

Currently, all the work is being done inside the refactoring branch. pyNPS - A cli Linux and Windows Nopaystation client made with python 3 and wget P

Everton Correia 45 Dec 11, 2022
Display Images in your terminal with python

A python library to display images in the terminal

Pranav Baburaj 57 Dec 30, 2022
Notion-cli-list-manager - A simple command-line tool for managing Notion databases

A simple command-line tool for managing Notion List databases. ✨

Giacomo Salici 75 Dec 04, 2022
Un module simple pour demander l'accord de l'utilisateur dans une CLI.

Demande de confirmation utilisateur pour CLI Présentation ask_lib est un module pour le langage Python proposant une seule fonction; ask(). Le but pri

CallMePixelMan 7 May 09, 2022
stonky is a simple command line dashboard for monitoring stocks.

stonky is a simple command line dashboard for monitoring stocks.

Jessy Williams 228 Dec 14, 2022
A simple script to make the operation of AltServer-Linux more easier with cli

A simple script to make the operation of AltServer-Linux more easier with cli

powen 23 Dec 13, 2022
A simple discord slash command handler for for discord.py.

A simple discord slash command handler for discord.py About ⦿ Installation ⦿ Disclaimer ⦿ Examples ⦿ Documentation ⦿ Discussions Note that master bran

641 Jan 03, 2023
Just a shell writed on Python

HIGHSHELL (also hSH or HS) Just a shell writed on Python Send bug report • How to use the shell • Broked features • Licenses How to use the shell Inst

0LungSkill0 2 Jan 04, 2022
A command line application, written in Python, for interacting with Spotify.

spotify-py-cli A command line application, written in Python, for interacting with Spotify. The primary purpose behind developing this app was to gain

Drew Loukusa 0 Oct 07, 2021
Kubernetes shell: An integrated shell for working with the Kubernetes

kube-shell Kube-shell: An integrated shell for working with the Kubernetes CLI Under the hood kube-shell still calls kubectl. Kube-shell aims to provi

CloudNative Labs 2.2k Jan 08, 2023
A simple command line chat app to communicate via the terminal.

A simple command line chat app to communicate via the terminal. I'm new to networking so sorry if some of my terminology or code is messed up.

PotNoodle 1 Oct 26, 2021
The Pythone Script will generate a (.)sh file with reverse shell codes then you can execute the script on the target

Pythone Script will generate a (.)sh file with reverse shell codes then you can execute the script on the targetPythone Script will generate a (.)sh file with reverse shell codes then you can execute

Boy From Future 15 Sep 16, 2022
A simple python script to execute a command when a YubiKey is disconnected

YubiKeyExecute A python script to execute a command when a YubiKey / YubiKeys are disconnected. ‏‏‎ ‎ How to use: 1. Download the latest release and d

6 Mar 12, 2022
Lexeme - CLI to play a word-guessing game like Wordle

What is this? Python program to play a word-guessing game like Wordle, but… More addictive because you can play it over and over and over, not just on

Dan Lenski 6 Oct 26, 2022
pwy - A simple weather tool.

A simple weather tool. I made this as a way for me to learn Python, API, and PyPi packaging. Name changed from wwy to pwy.

Clint 105 Dec 31, 2022