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
A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli. Stream your favorite shows straight from the command line.

A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli. Installation pip install -r requirements.txt It use

Jonardon Hazarika 17 Dec 11, 2022
Automaton - python script to execute bash command based on changes in size of a file.

automaton python script to execute given command <= everytime size of a given file changes,hence everytime a file is modified.(almost) download automa

asrar bhat 1 Jan 3, 2022
AML Command Transfer. A lightweight tool to transfer any command line to Azure Machine Learning Services

AML Command Transfer (ACT) ACT is a lightweight tool to transfer any command from the local machine to AML or ITP, both of which are Azure Machine Lea

Microsoft 11 Aug 10, 2022
This is a CLI utility that allows you to view RedFlagDeals.com on the command line.

RFD Description Motivation Installation Usage View Hot Deals View and Sort Hot Deals Search Advanced View Posts Shell Completion bash zsh Description

Dave G 8 Nov 29, 2022
This is a tool for managing file notes through the command line

This is a tool for managing file notes through the command line

null 2 Jun 22, 2022
A cd command that learns - easily navigate directories from the command line

NAME autojump - a faster way to navigate your filesystem DESCRIPTION autojump is a faster way to navigate your filesystem. It works by maintaining a d

William Ting 14.5k Jan 3, 2023
Ros command - Unifying the ROS command line tools

Unifying the ROS command line tools One impairment to ROS 2 adoption is that all

null 37 Dec 15, 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
Baseline is a cross-platform library and command-line utility that creates file-oriented baselines of your systems.

Baselining, on steroids! Baseline is a cross-platform library and command-line utility that creates file-oriented baselines of your systems. The proje

Nelson 4 Dec 9, 2022
inklayers is a command line program that exports layers from an SVG file.

inklayers is a command line program that exports layers from an SVG file. It can be used to create slide shows by editing a single SVG file.

null 11 Mar 29, 2022
A command-line utility that, given a markdown file, checks whether all its links work.

A command-line utility written in Python that checks validity of links in a markdown file.

Teclado 2 Dec 8, 2021
OneDriveExplorer - A command line and GUI based application for reconstructing the folder structure of OneDrive from the UserCid.dat file

OneDriveExplorer - A command line and GUI based application for reconstructing the folder structure of OneDrive from the UserCid.dat file

Brian Maloney 100 Dec 13, 2022
Command-line tool for looking up colors and palettes.

Colorpedia Colorpedia is a command-line tool for looking up colors, shades and palettes. Supported color models: HEX, RGB, HSL, HSV, CMYK. Requirement

Joohwan Oh 282 Dec 27, 2022
Simple command line tool for text to image generation using OpenAI's CLIP and Siren (Implicit neural representation network)

Simple command line tool for text to image generation using OpenAI's CLIP and Siren (Implicit neural representation network)

Phil Wang 4.4k Jan 9, 2023
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
PwnWiki command line searching tool & bindings written in Python

pwsearch PwnWiki 数据库搜索命令行工具。 安装 您可以直接用 pip 命令从 PyPI 安装 pwsearch: pip3 install -U pwsearch 您也可以 clone 该仓库并直接从源码启动

PwnWiki 20 Jun 21, 2021
Official AIdea command line tool

AIdea CLI Official AIdea command line tool for https://aidea-web.tw. Installation Make sure you have installed both Python 3 and pip package manager.

AIdea 5 Dec 15, 2021
PyArmor is a command line tool used to obfuscate python scripts

PyArmor is a command line tool used to obfuscate python scripts, bind obfuscated scripts to fixed machine or expire obfuscated scripts.

Dashingsoft 2k Jan 7, 2023