lf-lang / playground-lingua-franca

:rocket: Try Lingua Franca now!
Other
16 stars 13 forks source link

Create TaskSet Generator and GUI in Lingua Franca #3

Closed CloverCho closed 2 years ago

CloverCho commented 2 years ago

We create basic taskset generator. The generator is consist of 'Task' reactor and several 'Runner' reactors.

In the program, there is a bank of Tasks. These Tasks receive information(execution time, release time) for scheduling from Runners, and various runners can be designed based on each algorithm.

In this code, there are 3 runners 1) SimpleRunner: Runner with uniform task execution time and release time = 0 2) RunnerForMultipleWorkers: Runner considering number of workers when computing execution time 3) RandomReleaseRunner: Runner which set tasks' release times with random number

CloverCho commented 2 years ago

We made a python GUI program that generates task sets of Lingua Franca

When a user selects some options(Number of tasks, Utilization, Total execution time, sporadic/periodic, ...), the GUI program makes several LF programs by using a template named "BasicTaskGeneratorTemplate.lf" and a graph that represents execution time for the number of tasks. Currently, the graph shows the results for NP, GEDF_NP, and GEDF_NP_CI scheduler as following image.

gui_500

periodic_500

Soroosh129 commented 2 years ago

Wow, this looks great! Is this branch ready for review?

Soroosh129 commented 2 years ago

I get the following exception with the selected options:

TaskSetGenerator$ python3 gui.py 
File saved: /home/soroush/lingua-franca-master/git/hyu-iot/C/src/TaskSetGenerator/.gui/src/practice_NP_1.lf
Build successfully!
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.10/tkinter/__init__.py", line 1921, in __call__
    return self.func(*args)
  File "/home/soroush/lingua-franca-master/git/hyu-iot/C/src/TaskSetGenerator/gui.py", line 77, in runLfc
    exe_time.append(step(worker, scheduler))
  File "/home/soroush/lingua-franca-master/git/hyu-iot/C/src/TaskSetGenerator/gui.py", line 40, in step
    lf_out = subprocess.run([f'./.gui/bin/{filename}'], capture_output=True)
  File "/usr/lib/python3.10/subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.10/subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.10/subprocess.py", line 1842, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: './.gui/bin/practice_NP_1'

image

It looks like it is looking for a .gui/src/practice_NP_1 but there is a .gui/src/practice_NP_1.lf.

Soroosh129 commented 2 years ago

Thanks, it works!

CloverCho commented 2 years ago

Wow, this looks great! Is this branch ready for review?

Thank you for the detailed review! I think there are many things that need to be modified and added in this branch. (For example, making random period to sporadic task, enable to use other runner, that you gave us feedback on today's meeting) So I think it is better to change to 'ready for review' after I update those things.

Soroosh129 commented 2 years ago

@CloverCho is this PR ready to merge?

hokeun commented 2 years ago

I think we have a nice first version of the task set generator. @CloverCho How about merging this for now and updating it later gradually?

CloverCho commented 2 years ago

@Soroosh129 @hokeun I think it is better to merge now and update it later gradually. I will change its status

-----(updated) I have no write access to this repository. Could you merge this PR?