-
Notifications
You must be signed in to change notification settings - Fork 2
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
ARXIVNG-1108 implemented s3-backed storage for compilation products #4
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c138a6b
ARXIVNG-1108 started porting s3 integration (based on fulltext service)
erickpeirson 72131fb
ARXIVNG-1108 implemented s3-backed storage for compilation products
erickpeirson b59e22f
ARXIVNG-1108 added some docs
erickpeirson 5867e54
added a .coveragerc
erickpeirson 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 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,7 @@ | ||
[run] | ||
omit = | ||
*/app.py | ||
*/wsgi.py | ||
*/config.py | ||
docs/* | ||
*/tests* |
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,20 +1,88 @@ | ||
"""Domain class for the compiler service.""" | ||
|
||
from typing import NamedTuple | ||
|
||
from typing import NamedTuple, Optional | ||
import io | ||
from datetime import datetime | ||
from .util import ResponseStream | ||
|
||
|
||
class CompilationStatus(NamedTuple): | ||
"""Represents the state of a compilation product in the store.""" | ||
|
||
# These are intended as fixed class attributes, not slots. | ||
PDF = "pdf" # type: ignore | ||
DVI = "dvi" # type: ignore | ||
PS = "ps" # type: ignore | ||
|
||
CURRENT = "current" # type: ignore | ||
IN_PROGRESS = "in_progress" # type: ignore | ||
FAILED = "failed" # type: ignore | ||
|
||
# Here are the actual slots/fields. | ||
source_id: str | ||
|
||
format: str | ||
""" | ||
The target format of the compilation. | ||
|
||
One of :attr:`PDF`, :attr:`DVI`, or :attr:`PS`. | ||
""" | ||
|
||
source_checksum: str | ||
"""Checksum of the source tarball from the file management service.""" | ||
|
||
task_id: str | ||
"""If a task exists for this compilation, the unique task ID.""" | ||
|
||
status: str | ||
""" | ||
The status of the compilation. | ||
|
||
One of :attr:`CURRENT`, :attr:`IN_PROGRESS`, or :attr:`FAILED`. | ||
|
||
If :attr:`CURRENT`, the current file corresponding to the format of this | ||
compilation status is the product of this compilation. | ||
""" | ||
|
||
@property | ||
def ext(self) -> str: | ||
"""Filename extension for the compilation product.""" | ||
return self.format | ||
|
||
def to_dict(self) -> dict: | ||
"""Generate a dict representation of this object.""" | ||
return { | ||
'source_id': self.source_id, | ||
'format': self.format, | ||
'source_checksum': self.source_checksum, | ||
'task_id': self.task_id, | ||
'status': self.status | ||
} | ||
|
||
|
||
class CompilationProduct(NamedTuple): | ||
"""Content of a compilation product itself.""" | ||
|
||
stream: io.BytesIO | ||
"""Readable buffer with the product content.""" | ||
|
||
checksum: Optional[str] = None | ||
"""The B64-encoded MD5 hash of the compilation product.""" | ||
|
||
status: Optional[CompilationStatus] = None | ||
"""Status information about the product.""" | ||
|
||
|
||
class SourcePackage(NamedTuple): | ||
"""Source package content, retrieved from file management service.""" | ||
|
||
upload_id: str | ||
source_id: str | ||
stream: ResponseStream | ||
etag: str | ||
|
||
|
||
class SourcePackageInfo(NamedTuple): | ||
"""Current state of the source package in the file managment service.""" | ||
|
||
upload_id: str | ||
source_id: str | ||
etag: str |
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pinned this, because
1.3.5
has an internal dependency conflict: getmoto/moto#1813