aboutsummaryrefslogtreecommitdiff
path: root/scripts/update_virtuoso
diff options
context:
space:
mode:
authorPjotr Prins2020-05-20 09:39:46 -0500
committerPjotr Prins2020-05-20 09:39:46 -0500
commit700fb33d0e9d1d73d184dcee30ea294ba5f021e2 (patch)
tree8bc97d554b284ff64c2b6c9bfe938b1b0aa447cb /scripts/update_virtuoso
parentd0060bc74ee1f4bffdf89af4cfaa3ffa0c96b3e5 (diff)
downloadbh20-seq-resource-700fb33d0e9d1d73d184dcee30ea294ba5f021e2.tar.gz
bh20-seq-resource-700fb33d0e9d1d73d184dcee30ea294ba5f021e2.tar.lz
bh20-seq-resource-700fb33d0e9d1d73d184dcee30ea294ba5f021e2.zip
Virtuoso update in CRON
Diffstat (limited to 'scripts/update_virtuoso')
-rwxr-xr-xscripts/update_virtuoso/check_for_updates.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/update_virtuoso/check_for_updates.py b/scripts/update_virtuoso/check_for_updates.py
index 3deed7f..81496ce 100755
--- a/scripts/update_virtuoso/check_for_updates.py
+++ b/scripts/update_virtuoso/check_for_updates.py
@@ -18,6 +18,9 @@ fn = sys.argv[1]
user = sys.argv[2]
pwd = sys.argv[3]
+scriptdir = os.path.dirname(os.path.realpath(__file__))
+print(scriptdir)
+basedir = os.path.dirname(os.path.dirname(scriptdir))
def upload(fn):
# Upload into Virtuoso using CURL
@@ -33,10 +36,6 @@ 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)
@@ -57,6 +56,9 @@ if os.path.isfile(fn):
file.close
if stamp != last_modified_str:
+ upload(basedir+"/semantic_enrichment/labels.ttl")
+ upload(basedir+"/semantic_enrichment/countries.ttl")
+
print("Fetch metadata TTL")
r = requests.get(url)
assert(r.status_code == 200)
@@ -66,3 +68,5 @@ if stamp != last_modified_str:
upload("metadata.ttl")
with open(fn,"w") as f:
f.write(last_modified_str)
+else:
+ print("Metadata is up to date")