Giter Club home page Giter Club logo

linda's People

Contributors

pochka15 avatar

Watchers

 avatar

linda's Issues

Introduce coordinator executable

Goal

Create a makefile command to be able to run make run_coordinator. It must run the coordinator process that executes the code from the src/main.cpp#runCoordinator

Explanation

Now we have a reader and writer that communicate with each other in the src/main.cpp. We gradually migrate our architecture to finally implement this scenario. Now it runs the coordinator logic in the parent process (see the the src/main.cpp) and we need to extract it into a separate coordinator application.

We can already run the coordinator application but it prints TODO, you can run it by yourself: build Linda_coordinator -> run it from the build directory (./cmake-build-debug/src/Coordinator_lib/coordinator).

Please, do not edit the existing logic yet, meaning don't add methods to the existing coordinator and so on. Just put the code from src/main.cpp#runCoordinator in the coordinators main file and remove the 'Wait for each child' logic. You can simply wait for a few seconds and then close existing channels. Later we'll figure out how to refactor it.

Expected result

  • I run make build run_coordinator linda

  • Expect the same result as in the current version of the application:

    Result: reader received pattern: [1, Hello, 3.14]
    

Execute agent's scenario

Goal

Agent must be able to execute a list of actions taken from some scenario

Explanation

Now agent has 2 public methods: publishTupleBlocking and readBlocking. In our application we'll need to run it with a parameter --scenario someScenario.json. See how scenario looks like.

From my point of view it can be done in this way: you should go to the LindaAgent.h and add the executeScenario(const std::string &rawScenario) method. It should parse the given rawScenario which is a json stored in a string variable and for each action from the scenario we run publishTupleBlocking() or readBlocking() functions.

Also add the parameter --scenario someSceanrio.json (see Agent_lib/main.cpp) and make reader automatically run this scenario if this parameter is given

Please write tests for this feature. Example test:

'execute scenario EXPECT correct tuple is read': {
  tmpFile = create a temp file for the test
  spawn coordinator, reader, writer processes
  // reader process should be spawned with parameter --scenario someSceanrio.json --output pathToTmpFile

 writer.publishTuple(someTuple)
 wait for children
 assert tmpFileContains tuple from writer
}

Please work in a separate branch, not from main branch to be able to make Pull requests and reviews.

Expected result

I should be able to run reader --scenario someSceanrio.json. In the someScenario.json will be given just one readTuple action and it reader should read tuple correctly.

Create first tests

Goal

Implement test scenarios

Scenarios

  1. Run coordinator, writer, reader. Expect no applications get blocked, reader prints the received tuple

Notes

  • To do this you'd rather create a new Doctest_tests/ScenariosTest.cpp file
  • I highly recommend watching this youtube video. There is a chapter about posix_spawn(). I think it is what we need to spawn the processes and wait for them
  • Maybe some additional configurations will be needed in the CmakeLists because sometimes functions like posix_spawn don't work out of the box. (Not sure about this)
  • See the Makefile to figure out where we run processes from
  • Please create a separate branch for this issue

Expected result

make test runs tests and all of them should be passed

Introduce output parameter for agents

I should be able to run agent app and pass parameter: --output someFile.txt. When reader is run with this parameter I expect that received tuple will be written in this output file.

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.