-
-
Notifications
You must be signed in to change notification settings - Fork 22
remove s3 bucket polling #1049
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
Open
MattShirley
wants to merge
23
commits into
develop
Choose a base branch
from
1006-dont-poll-s3-for-bucket-contents
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
remove s3 bucket polling #1049
Changes from 6 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
11c652b
add backend route plus model, migration changes
MattShirley c812133
correct fail state
MattShirley 6d13aa1
remove unused imports
MattShirley 28d906c
handle null times
MattShirley 7a4907e
Update servicex_app/servicex_app/resources/internal/get_dataset_files…
MattShirley e6619d2
remove blank lines for flake8
MattShirley 1054a97
remove updated_at column
MattShirley 04d10ac
change endpoint to check transformation_results instead of files
MattShirley 0506106
flake8 compliance
MattShirley a1bff03
apply PR feedback
MattShirley 9b68d50
flake8
MattShirley bf20f28
flake8
MattShirley 6bbcce7
rename cutoff to begin_at
MattShirley b724501
add s3 object name
MattShirley 2ee24f1
add s3-object-name to TransformationResult.to_json
MattShirley 456c581
test what is in info
MattShirley c0f717c
fix breaking tests
MattShirley 4ff137b
flake8 compliance
MattShirley b593c70
test info
MattShirley a0969df
fix breaking tests
MattShirley 008d8c5
add first test
MattShirley e0936a2
flake8 compliance
MattShirley 6eaa001
flake8 compliance
MattShirley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
revision = 'v1_6_2' | ||
down_revision = 'v1_5_7a' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.add_column('files', sa.Column('created_at', sa.DateTime(), nullable=True)) | ||
op.add_column('files', sa.Column('updated_at', sa.DateTime(), nullable=True)) | ||
|
||
op.execute('UPDATE files SET created_at = CURRENT_TIMESTAMP, updated_at = CURRENT_TIMESTAMP') | ||
|
||
op.alter_column('files', 'created_at', nullable=False) | ||
op.alter_column('files', 'updated_at', nullable=False) | ||
|
||
op.create_index('ix_files_created_at', 'files', ['created_at']) | ||
op.create_index('ix_files_updated_at', 'files', ['updated_at']) | ||
|
||
|
||
def downgrade(): | ||
op.drop_index('ix_files_created_at', table_name='files') | ||
op.drop_index('ix_files_updated_at', table_name='files') | ||
|
||
op.drop_column('files', 'created_at') | ||
op.drop_column('files', 'updated_at') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
servicex_app/servicex_app/resources/internal/get_dataset_files_since.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import logging | ||
|
||
from datetime import datetime | ||
from flask_restful import reqparse | ||
|
||
from servicex_app.decorators import auth_required | ||
from servicex_app.models import DatasetFile | ||
from servicex_app.resources.servicex_resource import ServiceXResource | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class GetDatasetFilesSince(ServiceXResource): | ||
@auth_required | ||
def get(self): | ||
parser = reqparse.RequestParser() | ||
parser.add_argument('cutoff', type=str, location='args', required=False) | ||
args = parser.parse_args() | ||
files_query = DatasetFile.query | ||
|
||
if args.get('cutoff'): | ||
cutoff_str = args['cutoff'] | ||
|
||
try: | ||
if cutoff_str.endswith('Z'): | ||
cutoff_str = cutoff_str[:-1] + '+00:00' | ||
|
||
cutoff_datetime = datetime.fromisoformat(cutoff_str) | ||
|
||
files_query = files_query.filter(DatasetFile.created_at >= cutoff_datetime) | ||
MattShirley marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
logger.debug(f"Filtering files created after {cutoff_datetime}") | ||
except ValueError as e: | ||
logger.error(f"Error parsing cutoff datetime: {e}") | ||
return { | ||
'message': f"Invalid cutoff parameter: {cutoff_str}. Must be a valid ISO 8601 datetime (YYYY-MM-DDTHH:MM:SS+00:00)" | ||
}, 400 | ||
|
||
files = [file.to_json() for file in files_query] | ||
return { | ||
"files": files | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.