Skip to content
Snippets Groups Projects
Commit 78198c11 authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

WIP: created draft for generic analysis method

parent 59fe61af
No related branches found
No related tags found
2 merge requests!39Release 0.4.0,!20created draft for generic analysis method
Pipeline #15293 passed with warnings
# encoding: utf-8
#
# Copyright (C) 2021 Alexander Schlemmer <alexander.schlemmer@ds.mpg.de>
# Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
# Copyright (C) 2021 Henrik tom Wörden <h.tomwoerden@indiscale.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
#
# See: https://gitlab.indiscale.com/caosdb/src/caosdb-advanced-user-tools/-/issues/55
# This source file is work in progress and currently untested.
import importlib
import argparse
import caosdb as db
def _parse_arguments():
"""Parses the command line arguments.
"""
parser = argparse.ArgumentParser(description='__doc__')
parser.add_argument("--entity", help="An id an input dataset.")
parser.add_argument("--entity", help="An id of a parameter record.")
parser.add_argument(
'-a', '--auth-token', required=False,
help="An authentication token (not needed, only for compatibility).")
return parser.parse_args()
def run(plugin: str):
"""
Generically run a data analysis script.
This script should be installed as a pip package.
It should be located in package plugin and implement at least
a main function that takes a DataAnalysisRecord as a single argument.
"""
m = importlib.import_module(plugin)
args = _parse_arguments()
input_dataset = db.Record(id=args.entity)
parameters = db.Record(id=args.parameter)
dataAnalysisRecord = db.Record()
dataAnalysisRecord.add_property(input_dataset)
dataAnalysisRecord.add_property(parameters)
m.main(dataAnalysisRecord)
# Parent of all datasets which are used as input to or output from
# analysis scripts
Dataset:
# Parent of all parametersets which are used as input for analysis scripts
ParameterSet:
DataAnalysis:
recommended_properties:
InputDataset:
datatype: Dataset
OutputDataset:
datatype: Dataset
ParameterSet:
date:
\ No newline at end of file
#!/usr/bin/env python3
# Sync data model for generic data analysis method
# A. Schlemmer, 09/2021
from caosadvancedtools.models import parser
model = parser.parse_model_from_yaml("model.yml")
model.sync_data_model()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment