Beispiel #1
0
    def get(self, dataset_id):
        if dataset_id == 'dataset':
            if 'dataset_id' not in request.args or 'data_url' not in request.args:
                return jsonify({"status": 400, "msg": self.msg[400]})
            dataset_id = request.args['dataset_id']
            data_url = request.args['data_url']
            viz_config = None
            # http://minty.mintviz.org/minty/visualize/dataset?dataset_id=<>&viz_config_id=viz_config_<uuid2>&data_url=<>
            # viz_config_id=viz_config_<uuid2>&data_url=<>
            if 'viz_config' in request.args:
                viz_config = request.args['viz_config']
            else:
                return jsonify({"status": 400, "msg": self.msg[400]})
            # /visualize/dataset?dataset_id=<>&data_url=<>
            bash = find_bash_by_viz_config_for_run(viz_config)
            if bash:
                bash = bash._asdict()
                if bash['status'] in {'running', 'downloading', 'started'}:
                    return jsonify({"status": 307, "msg": self.msg[307]})

            getdata = api.dc_wrapper(bash_autorun=True)
            status = getdata.find_by_dataset_id(dataset_id, data_url=data_url, viz_config=viz_config) # job.status
            return jsonify({"dataset_id": dataset_id, "status": status, "msg": self.msg[status]})
        else:
        
            #    job = start a dc_wrapper with dataset_id
            getdata = api.dc_wrapper(bash_autorun=True)
            status = getdata.find_by_dataset_id(dataset_id) # job.status
            return jsonify({"dataset_id": dataset_id, "status": status, "msg": self.msg[status]})
Beispiel #2
0
 def post(self):
     jsonstr = request.form['reg_json']
     obj = json.loads(jsonstr)
     dcwrapper = api.dc_wrapper()
     reg_info = dcwrapper.register_to_dc(obj)
     if reg_info == 'error':
         return jsonify({"status": 'error'})
     return jsonify({"status": 'ok', "reg_info": reg_info})
Beispiel #3
0
 def post(self):
     dataset_id = request.form['dataset_id']
     viz_config = request.form['viz_config']
     option = request.form['option']
     unregister_dc = api.dc_wrapper()
     status = unregister_dc.unregister_dataset_visualize_status(
         dataset_id, viz_config, True if option == 'True' else False)
     return jsonify({"status": status})
Beispiel #4
0
 def post(self):
     dataset_id = request.form['dataset_id']
     viz_config = request.form['viz_config']
     dcwrapper = api.dc_wrapper()
     reg_info = dcwrapper.get_dataset_info_convert_to_register_info(
         dataset_id, viz_config)
     if reg_info == 'error':
         return jsonify({"status": 'error'})
     return jsonify({"status": 'ok', "reg_info": reg_info})
Beispiel #5
0
    def post(self):
        bashid = request.form["bashid"]
        bash = find_bash_by_id_for_run(bashid)
        if not bash:
            return jsonify({"status": "No record"})
        bash = bash._asdict()
        print(bash)
        if bash['status'] in {'running', 'downloading', 'started'}:
            return jsonify({"status": "It\'s running"})

        # if (bash['data_file_path'] == '' and os.path.exists(bash['dir'])) or (os.path.isfile(bash['data_file_path'])):
        #     run_bash(bashid)
        #     print(bashid)
        #     update_bash(bashid, status="running")
        # else:
        getdata = api.dc_wrapper()
        status = getdata.find_by_dataset_id(bash['dataset_id'],
                                            data_url=bash['data_url'],
                                            viz_config=bash['viz_config'])
        return jsonify({"status": "queued"})