diff --git a/default.nix b/default.nix index 9b863ba3c16e9f223481cc406b55254176e89495..417328886df8bd20b51ed32f8ea0c9ecb79bee53 100644 --- a/default.nix +++ b/default.nix @@ -1,62 +1,115 @@ -{ kapack ? import - (fetchTarball "https://github.com/oar-team/nur-kapack/archive/master.tar.gz") +{ + pkgs ? import ( + fetchTarball "https://github.com/NixOS/nixpkgs/archive/refs/tags/23.11.tar.gz") {} -, batsim ? kapack.batsim -, batexpe ? kapack.batexpe -, python3Packages ? kapack.pkgs.python3Packages -, pybatsim-core ? kapack.pybatsim-core -, poetry ? python3Packages.poetry-core +, kapack ? import + (fetchTarball "https://github.com/oar-team/nur-kapack/archive/901a5b656f695f2c82d17c091a55db2318ed3f39.tar.gz") + {inherit pkgs;} +, python3 ? pkgs.python311 +, python3Packages ? pkgs.python311Packages +# , pybatsim-core ? kapack.pybatsim-core +, poetry ? pkgs.poetry }: let - jobs = rec { - pkgs = kapack.pkgs; - lib = pkgs.lib; - pybatsim-example = python3Packages.buildPythonPackage rec { - pname = "pybatsim-example"; - version = "local"; - format = "pyproject"; - - src = lib.sourceByRegex ./sched [ - "^pyproject\.toml$" - "^poetry\.lock$" - "^.*\.py$" - ]; - buildInputs = [ - poetry - ]; - propagatedBuildInputs = [ - pybatsim-core - ]; - }; - # example shell that enables to run the example scheduler (run `pybatsim rejector` in the shell) - example-shell = pkgs.mkShell rec { - buildInputs = [ - pybatsim-example - ]; - }; + evalys = kapack.evalys.overrideAttrs (attr: rec { + name = "evalys"; + version = "d4d47bd2f4d076730b05f1345b1bf9032cd28753"; + src = pkgs.fetchgit rec { + url = "https://github.com/Mema5/evalys.git"; + rev = version; + sha256 = "sha256-eHGRNj2xWBoEgG2wvAZUoH1Us5d1yu9emu1Zyyms1JU="; + }; + }); + # small shell to dev and test schedulers dev = pkgs.mkShell rec { buildInputs = [ - pkgs.stdenv.cc.cc.lib + # pkgs.stdenv.cc.cc.lib poetry ]; + shellHook = '' + cd sched + poetry install + export VIRTUAL_ENV_DISABLE_PROMPT=1 + poetry shell + ''; - LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib"; + # LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib"; }; expe = pkgs.mkShell rec { buildInputs = [ - pkgs.stdenv.cc.cc.lib - poetry - pybatsim-core - batsim - batexpe + # pkgs.stdenv.cc.cc.lib + # poetry + # pybatsim-core + # kapack.batsim + # batexpe + # nixpkgs.qt6.qtbase + # nixpkgs.qt5.qtbase + (python3.withPackages + (ps: with ps; with python3Packages; [ + # jupyter ipython + numpy + matplotlib + # plotly pip tabulate pytz isodate ordered-set yattag + ]) + ) + evalys + + ]; + # QT_PLUGIN_PATH = with pkgs.libsForQt5.qt5; "${qtbase}/${qtbase.qtPluginPrefix}"; + QT_QPA_PLATFORM_PLUGIN_PATH= with pkgs.libsForQt5.qt5; "${qtbase.bin}/lib/qt-${qtbase.version}/plugins/platforms"; + # shellHook = '' + # QT_QPA_PLATFORM_PLUGIN_PATH="${qt6.qtbase.bin}/lib/qt-${qt6.qtbase.version}/plugins/platforms"; + # ''; + # nativeBuildInputs = [ nixpkgs.qt6.wrapQtAppsHook ]; + }; + + test = pkgs.mkShell rec { + buildInputs = [ + (python3.withPackages + (ps: with ps; with python3Packages; [ + matplotlib]) + ) ]; + # QT_PLUGIN_PATH = with nixpkgs.libsForQt5.qt5; "${qtbase}/${qtbase.qtPluginPrefix}"; + # QT_QPA_PLATFORM_PLUGIN_PATH= with nixpkgs.libsForQt5.qt5; "${qtbase.bin}/lib/qt-${qtbase.version}/plugins/platforms"; + # shellHook = '' + # QT_QPA_PLATFORM_PLUGIN_PATH="${qt6.qtbase.bin}/lib/qt-${qt6.qtbase.version}/plugins/platforms"; + # ''; + # nativeBuildInputs = [ nixpkgs.qt6.wrapQtAppsHook ]; }; + # lib = pkgs.lib; + # pybatsim-example = python3Packages.buildPythonPackage rec { + # pname = "pybatsim-example"; + # version = "local"; + # format = "pyproject"; + + # src = lib.sourceByRegex ./sched [ + # "^pyproject\.toml$" + # "^poetry\.lock$" + # "^.*\.py$" + # ]; + # buildInputs = [ + # poetry + # ]; + # propagatedBuildInputs = [ + # pybatsim-core + # ]; + # }; + + # # example shell that enables to run the example scheduler (run `pybatsim rejector` in the shell) + # example-shell = pkgs.mkShell rec { + # buildInputs = [ + # pybatsim-example + # ]; + # }; + + }; diff --git a/expe/plot.py b/expe/plot.py new file mode 100644 index 0000000000000000000000000000000000000000..dc0c0f16aa6a4eef2bea2d14cf1c51a529e59bac --- /dev/null +++ b/expe/plot.py @@ -0,0 +1,33 @@ +from evalys.jobset import JobSet +import matplotlib.pyplot as plt +import argparse + + +def plot(input, output, noDisplay): + js = JobSet.from_csv(input) + js.plot(with_details=True) + if output is not None: + plt.savefig(output) + if not noDisplay: + plt.show() + + +def main(): + parser = argparse.ArgumentParser( + description="Reads a SWF (Standard Workload Format) file and transform " + "it into a JSON Batsim workload (with delay jobs)") + + parser.add_argument('input_csv', type=str, + help='The input jobs.csv file') + parser.add_argument('-o', '--output_pdf', type=str, default=None, + help='The output PDF file') + parser.add_argument('--noDisplay', action="store_true", + help='If set, will not pop-up the graph') + + args = parser.parse_args() + plot(args.input_csv, args.output_pdf, args.noDisplay) + +if __name__ == "__main__": + main() + +