diff options
author | Pjotr Prins | 2020-11-11 10:30:17 -0600 |
---|---|---|
committer | Pjotr Prins | 2020-11-11 10:30:17 -0600 |
commit | 29bb29bb6bb814384b476e8bdb10bceeb185dab0 (patch) | |
tree | 6ade8224e9b8691e5ea0f5b9a4d8691f5692bdea /scripts/update_virtuoso | |
parent | af6fa67707e185dbb9099f7c1ca371e77bdaf2bb (diff) | |
download | bh20-seq-resource-29bb29bb6bb814384b476e8bdb10bceeb185dab0.tar.gz bh20-seq-resource-29bb29bb6bb814384b476e8bdb10bceeb185dab0.tar.lz bh20-seq-resource-29bb29bb6bb814384b476e8bdb10bceeb185dab0.zip |
Deployment
Diffstat (limited to 'scripts/update_virtuoso')
-rwxr-xr-x | scripts/update_virtuoso/check_for_updates.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/update_virtuoso/check_for_updates.py b/scripts/update_virtuoso/check_for_updates.py index 939a575..f32d0df 100755 --- a/scripts/update_virtuoso/check_for_updates.py +++ b/scripts/update_virtuoso/check_for_updates.py @@ -19,6 +19,10 @@ fn = sys.argv[1] user = sys.argv[2] pwd = sys.argv[3] +force = False +if fn== "--force": + force = True + no_cache = False if fn == "--no-cache": no_cache = True @@ -51,12 +55,12 @@ def upload(fn): print(out,err) assert(p.returncode == 0) -url = 'https://download.lugli.arvadosapi.com/c=lugli-4zz18-z513nlpqm03hpca/_/mergedmetadata.ttl' +url = 'https://collections.lugli.arvadosapi.com/c=lugli-4zz18-z513nlpqm03hpca/mergedMetadata.ttl' # --- Fetch headers from TTL file on Arvados # curl --head https://download.lugli.arvadosapi.com/c=lugli-4zz18-z513nlpqm03hpca/_/mergedmetadata.ttl r = requests.head(url) print(r.headers) -if not no_cache: +if not force and not no_cache: print(r.headers['Last-Modified']) # --- Convert/validate time stamp @@ -72,7 +76,7 @@ if os.path.isfile(fn): stamp = file.read() file.close -if no_cache or stamp != last_modified_str: +if force or no_cache or stamp != last_modified_str: print("Delete graphs") for graph in ["labels.ttl", "metadata.ttl", "countries.ttl"]: cmd = ("curl --digest -u dba:%s --verbose --url http://127.0.0.1:8890/sparql-graph-crud-auth?graph=http://covid-19.genenetwork.org/graph/%s -X DELETE" % (pwd, graph)) @@ -85,7 +89,7 @@ if no_cache or stamp != last_modified_str: upload(basedir+"/semantic_enrichment/labels.ttl") upload(basedir+"/semantic_enrichment/countries.ttl") - if not no_cache: + if force or not no_cache: print("Fetch metadata TTL") r = requests.get(url) assert(r.status_code == 200) @@ -93,7 +97,7 @@ if no_cache or stamp != last_modified_str: f.write(r.text) f.close upload("metadata.ttl") - if not no_cache: + if not force and not no_cache: with open(fn,"w") as f: f.write(last_modified_str) else: |