Skip to content

Commit 9f99f54

Browse files
committed
Active Python virtualenv at run-time
1 parent e2eb85a commit 9f99f54

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

scripts/archive-in-portico

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,14 @@ report=$outputdir/report.csv
5757
debuglog=$outputdir/debug.log
5858

5959

60+
# Set up Python environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61+
62+
CWD="$(cd -P -- "$(dirname -- "$mainscript")" && pwd -P)"
63+
source $CWD/env/bin/activate
64+
65+
6066
# Read helper functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6167

62-
CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
6368
source $CWD/helpers.sh
6469

6570

@@ -129,7 +134,7 @@ echo $today > $datestampfile
129134

130135
grep -F "Total articles" $log | \
131136
sed 's/Total //g;1 s/articles/Past failures retried/;2 s/articles/New &/' | \
132-
mail -s"Portico archiving results for $today" -a $report -a $log $EMAIL_SUCCESS
137+
mail -s "Portico archiving results for $today" -a $report -a $log $EMAIL_SUCCESS
133138

134139

135140
# Post the report to Slack ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

scripts/upload-to-pmc

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
#
2424
# 6. A log file is written to the output directory and named "run.log".
2525
#
26-
# 7. Successful results are uploaded to ftp.portico.org using ftp credentials
27-
# that are passed via environment variables PMC_USER and PMC_PASS.
26+
# 7. Archived articles are uploaded to ftp://ftp-private.ncbi.nlm.nih.gov/
27+
# using ftp credentials that are passed via environment variables
28+
# PMC_USER and PMC_PASS.
2829
#
2930
# 8. Outcomes are emailed to the comma-separated addresses in environment
3031
# variable $EMAIL_SUCCESS or $EMAIL_FAILURE, depending on whether
@@ -39,7 +40,7 @@
3940
mainscript=${BASH_SOURCE[0]}
4041

4142
# The file recording the results of the most recent run is stored at the
42-
# level of the directory indicatd by $PORTICO_OUTPUT, because this
43+
# level of the directory indicatd by $PMC_OUTPUT, because this
4344
# information is carried across runs.
4445
today=$(date +%Y-%m-%d)
4546
datestampfile=$PMC_OUTPUT/last-run-date
@@ -56,9 +57,14 @@ report=$outputdir/report.csv
5657
debuglog=$outputdir/debug.log
5758

5859

60+
# Set up Python environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61+
62+
CWD="$(cd -P -- "$(dirname -- "$mainscript")" && pwd -P)"
63+
source $CWD/env/bin/activate
64+
65+
5966
# Read helper functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6067

61-
CWD="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
6268
source $CWD/helpers.sh
6369

6470

@@ -92,7 +98,7 @@ run_microarchiver -s pmc -C -d $afterdate -o $outputdir -r $report -@ $debuglog
9298
# Did we have validation failures? Notify someone specifically about that.
9399
lines=$(grep validation $report | wc -l)
94100
if [[ $lines -gt 0 ]]; then
95-
mail -s"PMC upload stopped $today due to errors in $lines articles" \
101+
mail -s "PMC upload stopped $today due to errors in $lines articles" \
96102
-a $report -a $log $EMAIL_FAILURE
97103

98104
run_slack chat send --channel $SLACK_CHANNEL --color "#ff0000" \
@@ -118,7 +124,7 @@ else
118124

119125
# Send email about the results.
120126
grep -F "Total articles" $log | \
121-
mail -s"PMC upload results for $today" -a $report -a $log $EMAIL_SUCCESS
127+
mail -s "PMC upload results for $today" -a $report -a $log $EMAIL_SUCCESS
122128

123129
# Post the report to Slack.
124130

0 commit comments

Comments
 (0)