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
Bear-Shell is a shell based in the terminal or command prompt.

Bear-Shell is a shell based in the terminal or command prompt. You can navigate files, run python files, create files via the BearUtils text editor, and a lot more coming up!

MichaelBear 6 Dec 25, 2021
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
A simple CLI tool for converting logs from Poker Now games to other formats

🂡 Poker Now Log Converter 🂡 A command line utility for converting logs from Poker Now games to other formats. Introduction Poker Now is a free onlin

6 Dec 23, 2022
A CLI based task manager tool which helps you track your daily task and activity.

CLI based task manager tool This is the simple CLI tool can be helpful in increasing your productivity. More like your todolist. It uses Postgresql as

ritik 1 Jan 19, 2022
Quickly open any path on your terminal window in your $EDITOR of choice!

Tmux fpp Plugin wrapper around Facebook PathPicker. Quickly open any path on your terminal window in your $EDITOR of choice! Demo Dependencies fpp - F

257 Dec 28, 2022
AutoSub is a CLI application to generate subtitle files (.srt, .vtt, and .txt transcript) for any video file using Mozilla DeepSpeech.

AutoSub About Motivation Installation Docker How-to example How it works TO-DO Contributing References About AutoSub is a CLI application to generate

Abhiroop Talasila 414 Jan 06, 2023
🔖 Lemnos: A simple, light-weight command-line to-do list manager.

🔖 Lemnos: CLI To-do List Manager This is a simple program that allows one to manage a to-do list via the command-line. Example $ python3 todo.py add

Rohan Sikand 1 Dec 07, 2022
A CLI messenger for the Signum community.

A CLI messenger for the Signum community. Built for people who like using terminal for their work and want to communicate with other users in the Signum community.

Jush 5 Mar 18, 2022
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
A terminal tool for git. When we use git, do you feel very uncomfortable with too long commands

PIGIT A terminal tool for git. When we use git, do you feel very uncomfortable with too long commands. For example: git status --short, this project c

Zachary 1 Apr 09, 2022
Faza - Faza terminal, Faza help to beginners for pen testing

Faza terminal simple tool for pen testers Use small letter only for commands Don't use space after command 'help' for more information Installation gi

Ag3ntQ 5 Feb 20, 2022
Play videos in the terminal.

Termvideo Play videos in the terminal (stdout). python main.py /path/to/video.mp4 Terminal size: -x output_width, -y output_height. Default autodetect

Patrick 11 Jun 13, 2022
A simple CLI tool for tracking Pikud Ha'oref alarms.

Pikud Ha'oref Alarm Tracking A simple CLI tool for tracking Pikud Ha'oref alarms. Polls the unofficial API endpoint every second for incoming alarms.

Yuval Adam 24 Oct 10, 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
電通大のCLIツールです

uecli 電通大のCLIツールです。コマンドラインからシラバス検索、成績参照、図書館の貸出リストなどを見ることができます インストール pip install uecli 使い方 シラバスを検索 uecli syllabus search -s 'コンピュータサイエンス' シラバスを取得し、Mar

UEC World Dominators 2 Oct 31, 2021
Code for "Salient Deconvolutional Networks, Aravindh Mahendran, Andrea Vedaldi, ECCV 2016"

deconvnet_analysis Code for "Salient Deconvolutional Networks, Aravindh Mahendran, Andrea Vedaldi, ECCV 2016" Parts of this code Generate figures in t

Aravindh Mahendran 12 Jan 25, 2021
Joji convert a text to corresponding emoji if emoji is available

Joji Joji convert a text to corresponding emoji if emoji is available How it Works ? 1. There is a json file with emoji names as keys and correspondin

Gopikrishnan Sasikumar 28 Nov 26, 2022
You'll never want to use cd again.

Jmp Description Have you ever used the cd command? You'll never touch that outdated thing again when you try jmp. Navigate your filesystem with unprec

Grant Holmes 21 Nov 03, 2022
A command line utility to export Google Keep notes to markdown.

Keep-Exporter A command line utility to export Google Keep notes to markdown files with metadata stored as a frontmatter header. Supports exporting: S

Nathan Beals 85 Dec 17, 2022
A Tempmail Tool for Terminal and Termux.

A Tempmail Tool for Terminal and Termux.

MAO-COMMUNITY 8 Oct 19, 2022