Giter VIP home page Giter VIP logo

Comments (7)

sr-murthy avatar sr-murthy commented on June 12, 2024

The package/toolkit isn't just a CLI, it contains a Python class framework for creating and working with model lookups and generating keys as objects or files (oasislmf.keys.lookup), exposure management including all the workflows currently available via the CLI including generating keys, Oasis files, losses and running models (oasislmf.exposures), and a set of Python utilities used in the class framework but which can also be used for general purpose stuff independently of that (oasislmf.utils).

The existing CLI uses this class framework and utilities, but there is nothing to stop external users of the package from writing their own scripts, using this Python framework, for performing workflows to suit their own requirements.

from oasislmf.

mpinkerton-oasis avatar mpinkerton-oasis commented on June 12, 2024

Okay, but the point is that they might want to run against a hosted system via the web service APIs and not locally.

from oasislmf.

sr-murthy avatar sr-murthy commented on June 12, 2024

Understand. My point was that the CLI component of the oasislmf package comprises of the cmd subpackage. Other subpackages are not CLI components, but functional/logic components.

from oasislmf.

sr-murthy avatar sr-murthy commented on June 12, 2024

@mpinkerton-oasis This are three steps to implementing all of this:

  1. create a new workflow subpackage with a single workflow module, and move all the workflow logic currently embedded in the CLI command class module (oasislmf/cmd/model.py) into the new workflow module; this workflow logic module will be completely independent of the CLI and will just consist of top-level methods for performing the workflows;
  2. refactor the CLI command classes to use the relevant methods in the workflow module - you will still need to capture the command line arguments but they should all be just passed to the relevant method in the workflow module, without any processing
  3. create a new API CLI command module in the command subpackage (oasislmf/cmd) - this should contain one API command class per workflow; the classes will extend oasislmf.cmd.base.OasisBaseCommand but their logic will use a sequence of API calls to implement the workflow; the API subcommand will be a top-level subcommand, e.g. oasislmf api, and then the each workflow command will have an appropriate name, e.g. oasislmf api generate-oasis-files

1 and 2 are relatively simple tasks, but 3 will be more complex. Arguably you could view the API CLI as just a way of performing the same tasks as you do now with locally installed models using oasislmf model but with remotely installed models. So you could opt not to create a separate API CLI subpackage, but just augment the existing CLI command classes to include an API option, so, e.g.

oasislmf model generate-oasis-files --api <rest of args>

But this would make the existing CLI command classes more complex, so the first is probably a better option.

from oasislmf.

sr-murthy avatar sr-murthy commented on June 12, 2024

The workflow methods will still need to use the existing exposure manager oasislmf.exposures.manager.OasisExposuresManager to do the Oasis files generation, and to make calls to the utilities oasislmf.utils. So the workflow methods won't be that complex.

from oasislmf.

sambles avatar sambles commented on June 12, 2024

Notes on CLI:

oasislmf api --help
usage: oasislmf api [-h] [-V] [-C CONFIG] {run,list,delete} ...

positional arguments:
  {run,list,delete}
    run                 run
    list                list
    delete              delete

Example list:
oasislmf api list --api-server-url=http://localhost:8000 [--models / --portfolios / --analyses]

Example run:
oasislmf api list --api-server-url=http://localhost:8000 --model-id=1 --source-exposures-file-path=./source_loc.csv --analysis-settings-json-file-path=./settings_file.json

from oasislmf.

sambles avatar sambles commented on June 12, 2024

Still needs, create and healthcheck

from oasislmf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.