aboutsummaryrefslogtreecommitdiff
path: root/scripts/update_virtuoso
diff options
context:
space:
mode:
authorPjotr Prins2020-05-13 17:29:57 -0500
committerPjotr Prins2020-05-13 17:29:57 -0500
commitb42921d1327d38b75e183aab32d57d217dea3648 (patch)
tree29899a21791346398256b50fcc85b134e81c86ee /scripts/update_virtuoso
parenta481dc7cd67aca3e812580a594baed60beefe36e (diff)
parent5a82bb54ac7b345f904ba981368d29ccf4641875 (diff)
downloadbh20-seq-resource-b42921d1327d38b75e183aab32d57d217dea3648.tar.gz
bh20-seq-resource-b42921d1327d38b75e183aab32d57d217dea3648.tar.lz
bh20-seq-resource-b42921d1327d38b75e183aab32d57d217dea3648.zip
Merge branch 'master' of github.com:pjotrp/bh20-seq-resource
Diffstat (limited to 'scripts/update_virtuoso')
-rwxr-xr-xscripts/update_virtuoso/check_for_updates.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/update_virtuoso/check_for_updates.py b/scripts/update_virtuoso/check_for_updates.py
index fb69ff4..3deed7f 100755
--- a/scripts/update_virtuoso/check_for_updates.py
+++ b/scripts/update_virtuoso/check_for_updates.py
@@ -10,6 +10,8 @@
import requests
import time
import sys
+import os.path
+import subprocess
assert(len(sys.argv)==4)
fn = sys.argv[1]
@@ -31,11 +33,14 @@ def upload(fn):
print(output)
assert(p.returncode == 0)
+# --- Always update these
+upload("semantic_enrichment/labels.ttl")
+upload("semantic_enrichment/countries.ttl")
+
url = 'https://download.lugli.arvadosapi.com/c=lugli-4zz18-z513nlpqm03hpca/_/mergedmetadata.ttl'
# --- Fetch headers from TTL file on Arvados
r = requests.head(url)
print(r.headers)
-
print(r.headers['Last-Modified'])
# --- Convert/validate time stamp
@@ -45,14 +50,12 @@ t_stamp = time.strptime(last_modified_str,"%a, %d %b %Y %H:%M:%S %Z" )
print(t_stamp)
# OK, it works, now check last stored value
-import os.path
stamp = None
if os.path.isfile(fn):
file = open(fn,"r")
stamp = file.read()
file.close
-import subprocess
if stamp != last_modified_str:
print("Fetch metadata TTL")
r = requests.get(url)
@@ -61,8 +64,5 @@ if stamp != last_modified_str:
f.write(r.text)
f.close
upload("metadata.ttl")
- upload("semantic_enrichment/labels.ttl")
- upload("semantic_enrichment/countries.ttl")
-
with open(fn,"w") as f:
f.write(last_modified_str)