How to use the oasislmf.utils.log.oasis_log function in oasislmf

To help you get started, we’ve selected a few oasislmf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OasisLMF / OasisPlatform / src / server.bak / app.py View on Github external
@oasis_log()
def post_exposure():
    """
    Upload an exposure resource
    ---
    description: Uploads an exposure resource by posting an exposure tar file.
                 The tar file can be compressed or uncompressed.
    produces:
    - application/json
    responses:
        200:
            description: The exposure summary of the created exposure resource.
            schema:
                $ref: '#/definitions/ExposureSummary'
    """
    request_file = request.files['file']
    filename = uuid.uuid4().hex
github OasisLMF / OasisPlatform / src / server.bak / app.py View on Github external
@oasis_log()
def get_exposure(location):
    """
    Get an exposure resource
    ---
    description: Returns an exposure resource.
    produces:
    - application/json
    responses:
        200:
            description: A compressed tar file containing the Oasis exposure files.
        404:
            description: Resource not found
    parameters:
    - name: location
      in: path
      description: The location of the exposure resource.
github OasisLMF / OasisPlatform / src / model_execution_worker / supplier_model_runner.py View on Github external
@oasis_log()
def run(analysis_settings, number_of_processes=-1):
    if number_of_processes == -1:
        number_of_processes = multiprocessing.cpu_count()

    genbash(number_of_processes, analysis_settings, 'run_ktools.sh')
    try:
        subprocess.check_call(['bash', 'run_ktools.sh'])
    except subprocess.CalledProcessError as e:
        raise OasisException('Error running ktools: {}'.format(e.stderr))
github OasisLMF / OasisPlatform / src / server.bak / app.py View on Github external
@oasis_log()
def get_analysis_status(location):
    """
    Get an analysis status resource
    ---
    definitions:
    - schema:
        id: AnalysisStatus
        properties:
            id:
                type: string
                description: The analysis ID.
            status:
                type: string
                description: The analysis status.
            message:
                type: string
github OasisLMF / OasisPlatform / src / server.bak / app.py View on Github external
@oasis_log()
def get_exposure_summary(location):
    """
    Get exposure summary
    ---
    definitions:
     schema:
        id: ExposureSummary
        properties:
            location:
                type: string
                description: The location of the exposure data.
            size:
                type: integer
                description: The size of the uncompressed exposure data in bytes.
            created_date:
                type: string
github OasisLMF / OasisPlatform / src / server.bak / app.py View on Github external
@oasis_log()
def get_outputs(location):
    """
    Get a outputs resource
    ---
    description: Gets a outputs resource, returning a compressed outputs tar file.
    produces:
    - application/json
    responses:
        200:
            description: A compressed tar of the outputs generated by an analysis.
        404:
            description: Resource not found.
    parameters:
    -   name: location
        in: path
        description: The location of the outputs resource to download.
github OasisLMF / OasisPlatform / src / server.bak / app.py View on Github external
@oasis_log()
def spec():
    """
    Create Swagger docs
    """
    swag = swagger(APP)
    swag['info']['version'] = "0.1"
    swag['info']['title'] = "Oasis API"
    return jsonify(swag)
github OasisLMF / OasisPlatform / src / server.bak / app.py View on Github external
@oasis_log()
def delete_outputs(location):
    """
    download_directory = '/var/www/oasis/download'
    Delete a outputs resource
    ---
    description: Deletes a outputs resource. If no location is given all
                 outputs resources will be deleted.
    produces:
    - application/json
    responses:
        200:
            description: OK
        404:
            description: Resource not found
    parameters:
    - name: location
github OasisLMF / OasisPlatform / src / server.bak / app.py View on Github external
@oasis_log()
def delete_exposure(location):
    """
    Delete an exposure resource
    ---
    description: Deletes an exposure resource. If no location is given all exposure resources will be deleted.
    produces:
    - application/json
    responses:
        200:
            description: OK
        404:
            description: Resource not found
    parameters:
    - name: location
      in: path
      description: location of exposure resource to delete.
github OasisLMF / OasisPlatform / src / server.bak / app.py View on Github external
@oasis_log()
def post_analysis(input_location):
    """
    Start an analysis
    ---
    description: Starts an analysis by creating an analysis status resource.
    produces:
    - application/json
    responses:
        200:
            description: The analysis status resource for the new analysis.
            schema:
                $ref: '#/definitions/AnalysisStatus'
    produces:
    - application/json
    parameters:
    -   name: input_location