implement save method
This commit is contained in:
parent
3963b07c5f
commit
d5a48b91f0
2 changed files with 15 additions and 6 deletions
|
|
@ -6,7 +6,7 @@ import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from .input.implementations import codes
|
from .input.implementations import codes
|
||||||
from .tools import k2m
|
from .tools import k2m
|
||||||
from .tracker import get_file
|
from .tracker import get
|
||||||
# this will implement the search functionality
|
# this will implement the search functionality
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -144,7 +144,7 @@ def find_record(path, ensemble, correlator_name, code, project=None, parameters=
|
||||||
db = path + '/backlogger.db'
|
db = path + '/backlogger.db'
|
||||||
if code not in codes:
|
if code not in codes:
|
||||||
raise ValueError("Code " + code + "unknown, take one of the following:" + ", ".join(codes))
|
raise ValueError("Code " + code + "unknown, take one of the following:" + ", ".join(codes))
|
||||||
get_file(path, "backlogger.db")
|
get(path, "backlogger.db")
|
||||||
results = _db_lookup(db, ensemble, correlator_name,code, project, parameters=parameters, created_before=created_before, created_after=created_after, updated_before=updated_before, updated_after=updated_after, revision=revision)
|
results = _db_lookup(db, ensemble, correlator_name,code, project, parameters=parameters, created_before=created_before, created_after=created_after, updated_before=updated_before, updated_after=updated_after, revision=revision)
|
||||||
if code == "sfcf":
|
if code == "sfcf":
|
||||||
results = sfcf_filter(results, **kwargs)
|
results = sfcf_filter(results, **kwargs)
|
||||||
|
|
@ -153,13 +153,13 @@ def find_record(path, ensemble, correlator_name, code, project=None, parameters=
|
||||||
|
|
||||||
|
|
||||||
def find_project(path, name):
|
def find_project(path, name):
|
||||||
get_file(path, "backlogger.db")
|
get(path, "backlogger.db")
|
||||||
return _project_lookup_by_alias(os.path.join(path, "backlogger.db"), name)
|
return _project_lookup_by_alias(os.path.join(path, "backlogger.db"), name)
|
||||||
|
|
||||||
|
|
||||||
def list_projects(path):
|
def list_projects(path):
|
||||||
db = path + '/backlogger.db'
|
db = path + '/backlogger.db'
|
||||||
get_file(path, "backlogger.db")
|
get(path, "backlogger.db")
|
||||||
conn = sqlite3.connect(db)
|
conn = sqlite3.connect(db)
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
c.execute("SELECT id,aliases FROM projects")
|
c.execute("SELECT id,aliases FROM projects")
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,19 @@ import datalad.api as dl
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def get_file(path, file):
|
def get(path, file):
|
||||||
if file == "backlogger.db":
|
if file == "backlogger.db":
|
||||||
print("Downloading database...")
|
print("Downloading database...")
|
||||||
else:
|
else:
|
||||||
print("Downloading data...")
|
print("Downloading data...")
|
||||||
dl.get(os.path.join(path, file), dataset=path)
|
dl.get(os.path.join(path, file), dataset=path)
|
||||||
print("> downloaded file")
|
print("> downloaded file")
|
||||||
|
|
||||||
|
|
||||||
|
def save(path, message, files= None):
|
||||||
|
if files is None:
|
||||||
|
files = path
|
||||||
|
else:
|
||||||
|
files = [os.path.join(path, f) for f in files]
|
||||||
|
dl.save(files, message=message, dataset=path)
|
||||||
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue