Skip to content

Commit

Permalink
Merge pull request #788 from arXiv/arxivce-2763-postscript-submission
Browse files Browse the repository at this point in the history
[arXivCE-2763] Submission GCP was lacking the postscript submission (…
  • Loading branch information
ntai-arxiv authored Nov 3, 2024
2 parents 4f3a311 + d163d9a commit 7303dbd
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
TAG := arxiv-browse
NAME := arxiv-browse
DOCKERPORT := 8080
PROD_DB_PROXY_PORT := 2021
LOCALPORT := 6200
DBPROXYPORT := 6201
BROWSE_DOCKER_RUN := docker run --cpus 2 --rm -p ${LOCALPORT}:${DOCKERPORT} -e PORT=${DOCKERPORT} -v ${HOME}/arxiv/arxiv-browse/tests:/tests --name ${NAME} --env-file "${PWD}/tests/docker.env" --security-opt="no-new-privileges=true"
Expand All @@ -29,7 +30,7 @@ run: venv
. venv/bin/activate && python main.py

proxy:
/usr/local/bin/cloud-sql-proxy --address 0.0.0.0 --port 1234 arxiv-production:us-east4:arxiv-production-rep4 > /dev/null 2>&1 &
/usr/local/bin/cloud-sql-proxy --address 0.0.0.0 --port ${PROD_DB_PROXY_PORT} arxiv-production:us-central1:arxiv-production-rep9 > /dev/null 2>&1 &

dev-proxy:
/usr/local/bin/cloud-sql-proxy --address 0.0.0.0 --port ${DBPROXYPORT} arxiv-development:us-east4:arxiv-db-dev > /dev/null 2>&1 &
Expand Down
12 changes: 11 additions & 1 deletion script/sync_prod_to_gcp/submissions_to_gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class SubmissionFilesState:
Once the expectation is decided, it then maps the CIT file path to the GCP blob path.
"""
tex_submisson_exts: typing.List[str] = [".tar.gz", ".gz"]
submission_exts: typing.List[str] = [".tar.gz", ".gz", ".pdf", ".html.gz"]
submission_exts: typing.List[str] = [".ps.gz", ".tar.gz", ".gz", ".pdf", ".html.gz"]


xid: Identifier # paper id (aka arXiv ID)
Expand Down Expand Up @@ -532,6 +532,12 @@ def is_html_submission(self) -> bool:
assert(self.source_format)
return self.source_format == "html"

@property
def is_ps_submission(self) -> bool:
"""is a PostScript submission"""
assert(self.src_ext)
assert(self.source_format)
return self.source_format == "ps"

def get_tgz_top_levels(self) -> dict:
"""
Expand Down Expand Up @@ -599,6 +605,10 @@ def current(t, cit): # macro!? It's just easier to read code being here
# for the html, and it populates the files under the self.html_root_dir
files.append(current("html-cache", self.html_root_dir))
pass
elif self.is_ps_submission:
# Turn PS into PDF
files.append(current("pdf-cache", self.ps_cache_pdf_file))

pass

if self.publish_type in ["rep", "wdr"]:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
------------------------------------------------------------------------------
\\
arXiv:1008.9000
From: Cookie Monster <nobody@example.com>
Date: Wed, 17 Oct 2010 10:35:13 GMT (25kb)

Title: Zero to Infinite Cookies
Authors: Cookie Monster
Categories: math.NT math.AG
MSC-class: 14K20, 14K25, 14J15, 11F46, 14L24
DOI: 10.1090/proc/14940
License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
\\
We determine the correct number of cookies is infinite yet depending on
observer's position, the state of cookie becomes none.
\\
Binary file not shown.
21 changes: 21 additions & 0 deletions script/sync_prod_to_gcp/test/test_submissions_to_gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,3 +824,24 @@ def test_source_format_change(self):
'original': 'orig/arxiv/papers/2403/2403.99999v2.gz',
'gcp': 'orig/arxiv/papers/2403/2403.99999v2.gz'}
], expected)

def test_arxivce_2763(self):
test_data = {"type": "jref", "paper_id": "1008.9000", "version": "1", "src_ext": ""}

file_state = submission_message_to_file_state(test_data, {}, ask_webnode=False)
expected = trim_test_dir(file_state.get_expected_files())
self.assertEqual([
{'cit': '/data/ftp/arxiv/papers/1008/1008.9000.abs',
'gcp': 'ftp/arxiv/papers/1008/1008.9000.abs',
'status': 'current',
'type': 'abstract'},
{'cit': '/data/ftp/arxiv/papers/1008/1008.9000.ps.gz',
'gcp': 'ftp/arxiv/papers/1008/1008.9000.ps.gz',
'status': 'current',
'type': 'submission'},
{'cit': '/cache/ps_cache/arxiv/pdf/1008/1008.9000v1.pdf',
'gcp': 'ps_cache/arxiv/pdf/1008/1008.9000v1.pdf',
'status': 'current',
'type': 'pdf-cache'},
],
expected)

0 comments on commit 7303dbd

Please sign in to comment.