Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 4.0.0 #215

Merged
merged 122 commits into from
Mar 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
075fc75
Use dataclass
thomasyu888 Mar 2, 2020
acf6524
add uri into challenge class
thomasyu888 Mar 2, 2020
2b79577
Use dataclass and dataclass json
thomasyu888 Mar 2, 2020
dbecb32
Add challenge service
thomasyu888 Mar 2, 2020
2a1e5ed
Fix
thomasyu888 Mar 2, 2020
2bac2d9
Add in dataclasses req
thomasyu888 Mar 15, 2020
e1e6a25
Add in requirement
thomasyu888 Mar 15, 2020
2665e04
Use specific version
thomasyu888 Mar 15, 2020
c128520
Fix tests
thomasyu888 Mar 15, 2020
e8cc34d
Merge branch 'develop' into challenge-dataclass
thomasyu888 Mar 18, 2020
d3aa147
Remove last line
thomasyu888 Mar 18, 2020
6ad0de6
Revise challenge data obj + add challengeApi
thomasyu888 Apr 16, 2020
746ce88
Add tests
thomasyu888 Apr 16, 2020
ec71d4c
Merge branch 'develop' into challenge-dataclass
thomasyu888 Apr 16, 2020
5a7d8db
Add tests for challenge service
thomasyu888 Apr 16, 2020
ab2ec0e
Merge branch 'challenge-dataclass' of https://github.com/Sage-Bionetw…
thomasyu888 Apr 16, 2020
1ad71ef
test rest calls
thomasyu888 Apr 16, 2020
ce0f77e
Move synapse services to within challengeutils folder
thomasyu888 Apr 17, 2020
92ca97e
Fix tests
thomasyu888 Apr 17, 2020
4d18021
Fix tests
thomasyu888 Apr 17, 2020
8845fe9
Fix functions
thomasyu888 Apr 17, 2020
a92218c
Rename
thomasyu888 Apr 17, 2020
53c3e09
Switch to challenge instead of util
thomasyu888 Apr 17, 2020
2c0ecb9
Fix tests and finish up refactor
thomasyu888 Apr 17, 2020
885fe57
Remove duplicate
thomasyu888 Apr 17, 2020
5fe87cf
Remove unused var
thomasyu888 Apr 17, 2020
3fb14a1
Push dev version
thomasyu888 Apr 21, 2020
c2d751d
Merge branch 'master' into develop
thomasyu888 Apr 21, 2020
a78d3c0
Fix
thomasyu888 Apr 22, 2020
06d9888
Merge branch 'develop' into challenge-dataclass
thomasyu888 Apr 22, 2020
4edc0fd
Have consistent spacing
thomasyu888 Apr 22, 2020
8a1376a
Merge branch 'master' into develop
thomasyu888 Apr 22, 2020
139e456
Setter functions don't return anything
thomasyu888 Apr 22, 2020
0057c6c
Update to 1.6.1
thomasyu888 Apr 29, 2020
ab3b377
Fix client issue
thomasyu888 Apr 29, 2020
cbe8511
Only the getter needs to be documented'
thomasyu888 May 2, 2020
46e7c97
Create list registered challenges function + command line tool
thomasyu888 May 2, 2020
5ff3100
Add to client docs
thomasyu888 May 2, 2020
106f292
Split up admin/user guide
thomasyu888 May 3, 2020
1afae9e
lint
thomasyu888 May 3, 2020
a1c1873
Remove dependency for synapseclient < 2, fix setup.py, fix imports
thomasyu888 May 3, 2020
04fb391
import mock from unittest
thomasyu888 May 3, 2020
91e80c7
Software untested for 3.9
thomasyu888 May 3, 2020
d903d59
Fix import
thomasyu888 May 3, 2020
c2315a7
ADd in downloading of submissions
thomasyu888 May 3, 2020
6cbc630
Update challengeutils/challenge.py
thomasyu888 May 6, 2020
e8f56b9
Update challengeutils/__version__.py
thomasyu888 May 6, 2020
a09bf0e
Merge branch 'develop' into fix-mirror
thomasyu888 May 6, 2020
178e30f
Merge pull request #148 from Sage-Bionetworks/fix-imports
thomasyu888 May 6, 2020
abba3f5
Merge pull request #141 from Sage-Bionetworks/fix-mirror
thomasyu888 May 6, 2020
8c7b0b7
Merge branch 'develop' into challenge-dataclass
thomasyu888 May 6, 2020
8a4ba86
Remove
thomasyu888 May 6, 2020
0a32bf6
Merge pull request #112 from Sage-Bionetworks/challenge-dataclass
thomasyu888 May 6, 2020
da8c029
update docs theme; rearrange toc and pages (#155)
vpchung May 9, 2020
dab5025
Fix merge conflicts
thomasyu888 May 9, 2020
a206789
Push 2.0.1
thomasyu888 May 9, 2020
e854d89
Create CODE_OF_CONDUCT.md (#158)
thomasyu888 May 9, 2020
bfb3d0d
Create CONTRIBUTING.md (#159)
thomasyu888 May 9, 2020
fe21a89
Remove image
thomasyu888 May 9, 2020
2e5c002
update readme
thomasyu888 May 9, 2020
f375744
Edit
thomasyu888 May 9, 2020
bfdea07
Fix contributing guide path
thomasyu888 May 9, 2020
ded7795
Add space
thomasyu888 May 9, 2020
1a0c4fa
Add to change log
thomasyu888 May 9, 2020
6b9d33a
Merge branch 'master' into develop
thomasyu888 May 9, 2020
455e6a7
Remove travis dependency (#163)
thomasyu888 May 9, 2020
9483fae
Merge branch 'master' into develop
thomasyu888 May 9, 2020
f407441
Merge branch 'master' into develop
thomasyu888 May 9, 2020
d6b6bcd
update version
thomasyu888 May 9, 2020
a9b0826
Remove functionality to invite members to team (#167)
thomasyu888 May 15, 2020
0b21293
Create _copy_thread which just copies the threads, copy_thread now co…
thomasyu888 May 15, 2020
c7f0f8c
Fix createchallenge bug (#171)
thomasyu888 May 15, 2020
0540563
Automate code coverage (#165)
thomasyu888 May 15, 2020
6541710
Refactor mirror wiki (#143)
thomasyu888 May 15, 2020
9227fba
Add to documentation (#175)
thomasyu888 May 16, 2020
9d49e10
Merge branch 'master' into develop
thomasyu888 May 16, 2020
e88b4c0
Merge branch 'master' into develop
thomasyu888 May 16, 2020
963ca72
writeup commands (#130)
vpchung Jun 13, 2020
dd88d06
Updating annotations (#180)
thomasyu888 Jun 14, 2020
3b21074
Increase version
thomasyu888 Jun 14, 2020
23cf4d9
Increase version in conf.py
thomasyu888 Jun 14, 2020
c6bfddc
Add to docs
thomasyu888 Jun 14, 2020
e828614
Add function
thomasyu888 Jun 14, 2020
df612da
Add to docs
thomasyu888 Jun 14, 2020
5e906ed
Patch convert to synapse cls
thomasyu888 Jun 15, 2020
209b131
Add in function to delete submission (#182)
thomasyu888 Jun 15, 2020
eedd8e8
Add to docs and update cli syntax
thomasyu888 Jun 15, 2020
199678b
Fix merge conflict
thomasyu888 Jun 16, 2020
41dffbf
Upgrade synapseclient to 2.1.0 (#185)
thomasyu888 Jul 1, 2020
3566e31
Rename cli (#188)
thomasyu888 Jul 2, 2020
9d15600
Add thread service (#184)
thomasyu888 Jul 2, 2020
38df2a7
Patch project sub (#191)
thomasyu888 Jul 4, 2020
c28fc41
validate docker submission (#86)
thomasyu888 Jul 7, 2020
78fc7be
add logic for private writeup that must be shared with admin (#195)
vpchung Jul 10, 2020
2ef03fc
Add annotate sub (#194)
thomasyu888 Jul 15, 2020
303a9a6
Update docs (#192)
thomasyu888 Jul 16, 2020
4c32905
Merge branch 'master' into develop
thomasyu888 Jul 16, 2020
81b0e0f
Add -dev
thomasyu888 Jul 16, 2020
c1cb995
Add in function to remove members from team (#197)
thomasyu888 Sep 26, 2020
6fdb4f3
Use github token instead of personal access token (#199)
thomasyu888 Oct 28, 2020
d543371
update synapse to at least v2.2.0 (#200)
thomasyu888 Oct 29, 2020
12522eb
Update challengeutils/__version__.py
thomasyu888 Oct 29, 2020
72e7aed
Get team member count rest call (#201)
thomasyu888 Dec 1, 2020
1643e4b
Update challengeutils/__version__.py
thomasyu888 Dec 10, 2020
b6740a9
Move to team module (#202)
thomasyu888 Jan 1, 2021
3faab17
Merge branch 'master' into develop
thomasyu888 Jan 22, 2021
53a2af8
Pull and push synapse wikis in markdown + wiki config (#133)
thomasyu888 Feb 2, 2021
5d0b184
Update docs/client/source.rst
thomasyu888 Feb 2, 2021
a3e76f0
Bump version
thomasyu888 Feb 2, 2021
0493ba3
Update challengeutils/__main__.py
thomasyu888 Feb 2, 2021
66e10c0
fix conditionals for permissions
vpchung Feb 11, 2021
e626398
Fix merge conflicts
thomasyu888 Feb 11, 2021
ee0f174
Merge branch 'develop' into writeup-fix
thomasyu888 Feb 11, 2021
6b49c30
Merge pull request #212 from Sage-Bionetworks/writeup-fix
vpchung Feb 12, 2021
5f4c3f6
Add release
thomasyu888 Mar 4, 2021
4200fb4
Update setup.py
thomasyu888 Mar 4, 2021
3bad898
Update syn client (#214)
thomasyu888 Mar 6, 2021
f3bd88b
Deprecate helpers (#213)
thomasyu888 Mar 6, 2021
b7be712
Fix merge conflicts
thomasyu888 Mar 6, 2021
d6b32e7
Apply suggestions from code review
thomasyu888 Mar 6, 2021
69e2558
Update docs/about/changelog.rst
thomasyu888 Mar 6, 2021
88e1e95
Update docs
thomasyu888 Mar 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.6
FROM python:3.8

WORKDIR /root/challengeutils
COPY ./ ./
Expand Down
2 changes: 1 addition & 1 deletion challengeutils/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.2.0"
__version__ = "4.0.0"
162 changes: 0 additions & 162 deletions challengeutils/helpers.py

This file was deleted.

60 changes: 57 additions & 3 deletions challengeutils/submission.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
"""Functions that interact with submissions"""
import os
import re
import sys
import time
from typing import Union

import pandas as pd
import synapseutils
from synapseclient import AUTHENTICATED_USERS, entity, Project
from synapseclient import (AUTHENTICATED_USERS, entity, Project, Synapse,
SubmissionViewSchema)
from synapseclient.annotations import to_submission_status_annotations
from synapseclient.core.exceptions import SynapseHTTPError
from synapseclient.core.utils import id_of

from . import dockertools
from . import permissions
from . import utils
from . import annotations

WORKFLOW_LAST_UPDATED_KEY = "orgSagebionetworksSynapseWorkflowOrchestratorWorkflowLastUpdated"
WORKFLOW_START_KEY = "orgSagebionetworksSynapseWorkflowOrchestratorExecutionStarted"
TIME_REMAINING_KEY = "orgSagebionetworksSynapseWorkflowOrchestratorTimeRemaining"


def append_writeup_to_main_submission(row, syn):
Expand Down Expand Up @@ -145,7 +154,7 @@ def _validate_public_permissions(syn, proj):
syn_users_perms = syn.getPermissions(
proj.entityId, AUTHENTICATED_USERS)
public_perms = syn.getPermissions(proj.entityId)
if set(syn_users_perms) == {"READ", "DOWNLOAD"} and \
if ("READ" in syn_users_perms and "DOWNLOAD" in syn_users_perms) and \
"READ" in public_perms:
error = ""

Expand All @@ -166,7 +175,7 @@ def _validate_admin_permissions(syn, proj, admin):
try:
# Remove error message if admin has read and download permissions.
admin_perms = syn.getPermissions(proj.entityId, admin)
if set(admin_perms) == {"READ", "DOWNLOAD"}:
if "READ" in admin_perms and "DOWNLOAD" in admin_perms:
error = ""

except SynapseHTTPError as e:
Expand Down Expand Up @@ -310,3 +319,48 @@ def download_current_lead_sub(syn, submissionid, status,
cutoff_annotation, verbose)
return path
return None


def stop_submission_over_quota(
syn: Synapse,
submission_view: Union[str, SubmissionViewSchema],
quota: int = sys.maxsize
):
"""Stops any submission that has exceeded the run time quota by using
submission views. A submission view must first exist.
Rerunning submissions will require setting TimeRemaining annotation
to a positive integer.

Args:
syn: Synapse connection
submission_view: Submission View or its Synapse Id.
quota: Quota in milliseconds. Default is sys.maxsize.
One hour is 3600000.

"""
if not isinstance(quota, int):
raise ValueError("quota must be an integer")
if quota <= 0:
raise ValueError("quota must be larger than 0")

try:
view_query = syn.tableQuery(
f"select {WORKFLOW_LAST_UPDATED_KEY}, {WORKFLOW_START_KEY}, id, "
f"status from {id_of(submission_view)} where "
"status = 'EVALUATION_IN_PROGRESS'"
)
except SynapseHTTPError as http_error:
raise ValueError(
"Submission view must have columns: "
f"{WORKFLOW_LAST_UPDATED_KEY}, {WORKFLOW_START_KEY}, id"
) from http_error

view_querydf = view_query.asDataFrame()
runtime = (view_querydf[WORKFLOW_LAST_UPDATED_KEY] -
view_querydf[WORKFLOW_START_KEY])
submissions_over_quota_idx = runtime > quota
over_quotadf = view_querydf[submissions_over_quota_idx]
for index, row in over_quotadf.iterrows():
add_annotations = {TIME_REMAINING_KEY: 0}
annotations.annotate_submission(syn, row['id'], add_annotations,
is_private=False, force=True)
19 changes: 19 additions & 0 deletions docs/about/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ For older releases, visit the `GitHub releases`_.

.. _Github releases: https://github.com/Sage-Bionetworks/challengeutils/releases

v4.0.0
------
.. Important::
**Support for synapseclient<2.3.0 is no longer available**; upgrade to the
latest version with:

.. code:: console

$ pip install synapseclient --upgrade

.. Important::
**Support for Python 3.6 is will be dropped in the later
half of this year.

- Support `Python` 3.9
- Deprecate `helpers.py` and create `stop_submissions_over_quota` function
- Fix conditionals when validating permissions for project submissions


v3.2.0
------

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
author = 'Thomas Yu'

# The short X.Y version
version = '3.2'
version = '4.0'
# The full version, including alpha/beta/rc tags
release = version

Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pandas==1.0.1
synapseclient==2.1.0
pandas==1.1.5
synapseclient==2.3.0
challengeutils
sphinx_rtd_theme
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pandas==1.0.1
synapseclient==2.2.2
pandas
synapseclient==2.3.0
58 changes: 42 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,45 @@
with open("README.md", "r") as fh:
long_description = fh.read()

setup(name='challengeutils',
version=about["__version__"],
description='Challenge utility functions',
url='https://github.com/Sage-Bionetworks/challengeutils',
author='Thomas Yu',
author_email='thomasyu888@gmail.com',
long_description=long_description,
long_description_content_type="text/markdown",
license='Apache',
packages=find_packages(),
zip_safe=False,
python_requires='>=3.6, <3.9',
scripts=['bin/runqueue.py'],
entry_points={'console_scripts': ['challengeutils = challengeutils.__main__:main']},
install_requires=['pandas>=1.0.0',
'synapseclient>=2.2.0'])
setup(
name='challengeutils',
version=about["__version__"],
description='Challenge utility functions',
url='https://github.com/Sage-Bionetworks/challengeutils',
author='Thomas Yu',
author_email='thomasyu888@gmail.com',
long_description=long_description,
long_description_content_type="text/markdown",
license='Apache',
packages=find_packages(),
zip_safe=False,
python_requires='>=3.6, <3.10',
scripts=['bin/runqueue.py'],
entry_points={
'console_scripts': ['challengeutils = challengeutils.__main__:main']
},
install_requires=['pandas>=1.1.5',
'synapseclient>=2.3.0'],
project_urls={
"Documentation": "https://sage-bionetworks.github.io/challengeutils/",
"Source Code": "https://github.com/Sage-Bionetworks/challengeutils",
"Bug Tracker": "https://github.com/Sage-Bionetworks/challengeutils/issues",
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Operating System :: Unix',
'Operating System :: POSIX :: Linux',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Topic :: Software Development :: Libraries',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Bio-Informatics'],
)
Loading