Commit 84d6936d authored by Aaron Bray's avatar Aaron Bray
Browse files

Discritized verification!

parent 3ce08984
......@@ -109,6 +109,7 @@ configure_file(${CMAKE_SOURCE_DIR}/bin/run.cmake.in ${CMAKE_INSTALL_PREFIX}/bin/
configure_file(${CMAKE_SOURCE_DIR}/bin/run.config.in ${CMAKE_INSTALL_PREFIX}/bin/run.config @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/docs/Doxygen/full.doxy.in ${CMAKE_INSTALL_PREFIX}/bin/docs/full.doxy @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/cmake/PulseConfig.cmake.in ${CMAKE_INSTALL_PREFIX}/PulseConfig.cmake @ONLY)
configure_file(${CMAKE_SOURCE_DIR}/bin/Rebase.py.in ${CMAKE_INSTALL_PREFIX}/bin/Rebase.py @ONLY)
# Install Eigen
install(DIRECTORY ${Eigen_INSTALL}/include
......
......@@ -3,30 +3,48 @@
import argparse
import os
import fnmatch
import json
import mimetypes
import errno
import girder_client
import hashlib
from girder_client import GirderClient
from distutils.version import StrictVersion
if StrictVersion(girder_client.__version__) < StrictVersion("2.0.0"):
raise Exception("Girder 2.0.0 or newer is required")
class GirderExternalDataCli(GirderClient):
"""
A command line Python client for interacting with a Girder instance's
RESTful api, specifically for performing uploads into a Girder instance.
"""
def __init__(self, apiKey, objectStore):
def __init__(self, apiKey, validationFolder):
"""initialization function to create a GirderCli instance, will attempt
to authenticate with the designated Girder instance.
"""
GirderClient.__init__(self,
apiUrl='https://data.kitware.com/api/v1')
self.objectStore = objectStore
self.validationFolder = validationFolder
self.authenticate(apiKey=apiKey)
self.addItemUploadCallback(self.itemCallback)
def itemCallback(self, item, filepath):
# assume we have an itemMetadata dict that has
# filepath: metadata_dict_for_item
print("I just uploaded " + item['_id'])
print("Its hash is " + self.item_hash)
def mkdir_p(self, path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
def content_link_upload(self, localFolder, parentId, ext='.sha512',
def content_link_upload(self, localFolder, parentId, ext='.zip',
parentType='folder', blacklist=['.git', '.ExternalData'],
reuseExisting=True, dryRun=False):
"""Upload objects corresponding to CMake ExternalData content links.
......@@ -60,7 +78,7 @@ class GirderExternalDataCli(GirderClient):
dryRun=dryRun)
def _uploadContentLinkItem(self, name, content_link, folder,
ext='.sha512', parentType='folder', dryRun=False,
ext='.zip', parentType='folder', dryRun=False,
reuseExisting=False):
"""Upload objects corresponding to CMake ExternalData content links.
......@@ -73,6 +91,7 @@ class GirderExternalDataCli(GirderClient):
the same name in the same location, or create a new one instead.
:param dryRun: Do not actually upload any content.
"""
full_name = name + ext
content_link = os.path.normpath(content_link)
if os.path.isfile(content_link) and \
fnmatch.fnmatch(content_link, '*' + ext):
......@@ -81,17 +100,26 @@ class GirderExternalDataCli(GirderClient):
% parentType) +
' Items can only be added to folders.')
else:
with open(content_link, 'r') as fp:
hash_value = fp.readline().strip()
m = hashlib.sha512()
with open(content_link, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
m.update(chunk)
self.item_hash = m.hexdigest()
sha_file = content_link[content_link.find('scenarios'):]
full_path = self.validationFolder + "\\" + sha_file
self.mkdir_p(os.path.dirname(full_path))
f = open(self.validationFolder+"\\"+sha_file+".sha512", "w+")
f.write(self.item_hash)
self._uploadAsItem(
name,
full_name,
folder['_id'],
os.path.join(self.objectStore, hash_value),
content_link,
reuseExisting=reuseExisting,
dryRun=dryRun)
dryRun=dryRun
)
def _uploadFolderRecursive(self, localFolder, parentId, parentType,
ext='.sha512',
ext='.zip',
reuseExisting=False,
blacklist=[],
dryRun=False):
......@@ -166,15 +194,15 @@ def main():
help='will not write anything to Girder, only report on what would '
'happen')
parser.add_argument('--api-key', required=True, default=None)
parser.add_argument('--local-folder', required=False,
default=os.path.join(os.path.dirname(__file__), '..',
'..'),
help='path to local target folder')
# Default is Pulse/verification
parser.add_argument('--parent-id', required=False,
default='598c95d88d777f7d33e9c1fa',
help='id of Girder parent target')
parser.add_argument('--object-store', required=True,
parser.add_argument('--rebase-folder', required=False,
default='./test_results/rebase/',
help='path to local target folder')
parser.add_argument('--validation-folder', required=False,
default='@CMAKE_SOURCE_DIR@/verification',
help='Path to the CMake ExternalData object store')
parser.add_argument(
'--no-reuse', action='store_true',
......@@ -182,9 +210,8 @@ def main():
args = parser.parse_args()
reuseExisting = not args.no_reuse
gc = GirderExternalDataCli(args.api_key,
objectStore=os.path.join(args.object_store, 'SHA512'))
gc.content_link_upload(args.local_folder, args.parent_id,
gc = GirderExternalDataCli(args.api_key, args.validation_folder)
gc.content_link_upload(args.rebase_folder, args.parent_id,
reuseExisting=reuseExisting, dryRun=args.dry_run)
if __name__ == '__main__':
......
......@@ -21,5 +21,8 @@
<classpathentry kind="var" path="SOURCE_DIR/jar/reflections-0.9.9-RC1-uberjar.jar"/>
<classpathentry kind="var" path="SOURCE_DIR/jar/xmlbeans-2.6.0.jar"/>
<classpathentry kind="var" path="SOURCE_DIR/jar/zip4j-1.3.1.jar"/>
<classpathentry kind="var" path="SOURCE_DIR/jar/org.eclipse.jgit-4.11.0.201803080745-r.jar"/>
<classpathentry kind="var" path="SOURCE_DIR/jar/slf4j-api-1.7.25.jar"/>
<classpathentry kind="var" path="SOURCE_DIR/jar/slf4j-simple-1.7.25.jar"/>
<classpathentry kind="output" path="build/java"/>
</classpath>
......@@ -30,7 +30,4 @@ Macro EngineUnitTest=EngineUnitTestDriver FastPlot Baseline=unit_tests/pulse/ Co
Macro EngineUnitTestFull=EngineUnitTestDriver FullPlot Baseline=unit_tests/pulse/ Computed=./test_results/unit_tests/pulse
Macro ScenarioTest=ScenarioTestDriver FastPlot Baseline=scenarios/ Computed=./test_results/scenarios
patient/BasicStandard.pba = ScenarioTest
InterCircuitIndividual = CDMUnitTest Results=InterCircuitIndividual1,InterCircuitIndividual2
DynamicallyChangingCircuit = CDMUnitTest
ReadPatientDirectory = CDMUnitTestDriver NoCompare Computed=./test_results/unit_tests/cdm/
\ No newline at end of file
patient/BasicStandard.pba = ScenarioTest
\ No newline at end of file
......@@ -113,6 +113,7 @@ drug/Midazolam.pba = ScenarioTest
drug/Morphine.pba = ScenarioTest
drug/Naloxone.pba = ScenarioTest
drug/Norepinephrine.pba = ScenarioTest
drug/NorepinephrineBolus.pba = ScenarioTest
drug/Pralidoxime.pba = ScenarioTest
drug/Prednisone.pba = ScenarioTest
drug/Propofol.pba = ScenarioTest
......
......@@ -12,11 +12,13 @@ import org.eclipse.jgit.lib.ObjectId;
import mil.tatrc.physiology.utilities.FileUtils;
import mil.tatrc.physiology.utilities.Log;
import mil.tatrc.physiology.utilities.RunConfiguration;
import mil.tatrc.physiology.utilities.UnitConverter;
public class Rebase
{
public static void main(String[] args)
{
UnitConverter.initialize("./");
RunConfiguration cfg = new RunConfiguration();
Log.setFileName("Rebase.log");
String toDir = "./test_results/rebase/";
......@@ -102,6 +104,11 @@ public class Rebase
scenario_file = "";
result_files.clear();
result_path = job.computedFiles.get(0);
if(!new File(result_path).exists())
{
Log.error("Unable to find file to rebase for "+job.name);
continue;
}
if(job.name.endsWith(".pba"))
{
......
fee75c936302767fb3b795fe90c87c8c68b3f509ec114080c3cd1e341ace653c7e6155798cd731230457da982139d03d6b7eab7fd1e97b96924f8ee4dbed8b26
\ No newline at end of file
5791c87155b50065656bd94a869b663173a080c0797cbd99775b6e6e7a0f6d30b6f778f7cc9c49f9f6f95d8153e6542ee593b8d9ac129e2f249aca3557c28a67
\ No newline at end of file
de7cfe33e83bc40191ac607c1b8c307bffc2471b12d8ed235c9ab32cd40b57e559baa16ec42e5cc2451193e0854196f67f35a2022fe9d5c993878de971821207
\ No newline at end of file
251338a4b48cb188f8756028d245b4f65d2e47441165cdb90271d2c7b9c7e8251141d6c77e0353e4d359a3e672bd108fd1e1d3854188bf295bb912487245a3fe
\ No newline at end of file
342955328d6fa6bbaf7675daed0e7f564ad475b164f5b2303cdee267236126be961abf0c7db11897aec98b9dd765f9a852cc3d6a915350b2f9019ef295ba43eb
\ No newline at end of file
35dd83948a95afc0db8917002c9798ba84333c8628a6d68286da15b2ec5a1a261aec2f4c60924cf0399dce942de7f55cd0c5ba2b89277642a59059dbc888997f
\ No newline at end of file
8a9e368b23c7328694d3d5c34d09865715a6ede265c74af1aa6410b5bb4f842f4eb7a383ba398f0d07a4ea8e613baace97d5d41fae969ab12ba3c11213879f34
\ No newline at end of file
1b701e69561e40054db2b460b0c077ffb03b78c3665db6118bdf7fa5c184b9d1ea0e15d3f089518c4786626fe503eb90f93c906f3b33ffbc9faa04ffa7837bdc
\ No newline at end of file
ed99737fd6c0ecb8ea7556c201cf7a216999c167ad51a15b4925e1479446766bfd61822f157b1154d5bdd8a7cbc15b05e41803a555fa72b28372429fd4729a02
\ No newline at end of file
db07dc70a2c21400624db9dc77687d648d2bc061966887c4fc5c9e47ade013639336661f3b7132ac834c769a660a94539027d1ae125aed1f94ece1e9e7fff913
\ No newline at end of file
328fd6ca92904e0b82240227e548e8700cf7a4520bf4db1d00d63c818d2f2c3237392506892a935db3c22598cf2d6fd1a566d9d34d15c9e3e71f71ae57ff4232
\ No newline at end of file
93b17019e83e4ee7058f2ab1b0bfd1487263ca38f53b0864dfbcc3dbd2c0537ecac2c38f98a6e0a1b71c12dafe3c4531dc8e205cd8b1b47b4cbbcc0246ea8012
\ No newline at end of file
091715068ad85946f4f1fc89bd4ae437cac3c077caab12696ff60b70488c7a12006124a5da08325e70bcaf0afcacb3677c9ce9abb0f8e5cac2b0889167918578
\ No newline at end of file
d609d2bd1126489c28c2c662b4b36829e510410f4b3aa400d587e1668101ea2b42c67928c3f80beba709523d51b05dd50fa402fa159fcbd08ede2aa4aa4d27db
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment