From fabdf64cfe54d97f505230ac6ba9beefa95e4bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Madon?= <mael.madon@irit.fr> Date: Thu, 13 Apr 2023 21:43:08 +0200 Subject: [PATCH] restructure repo for smooth packaging --- pyproject.toml | 2 ++ {src => swf2userSessions}/__init__.py | 0 .../swf2userSessions.py | 13 ++++++++----- {src => swf2userSessions}/user_session_builder.py | 2 +- {src => swf2userSessions}/workload.py | 0 5 files changed, 11 insertions(+), 6 deletions(-) rename {src => swf2userSessions}/__init__.py (100%) rename swf2userSessions.py => swf2userSessions/swf2userSessions.py (97%) rename {src => swf2userSessions}/user_session_builder.py (99%) rename {src => swf2userSessions}/workload.py (100%) diff --git a/pyproject.toml b/pyproject.toml index 8b72732..75fbea1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,3 +17,5 @@ classifiers = [ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", ] +[project.scripts] +swf2userSessions = "swf2userSessions.swf2userSessions:parse_from_cli" \ No newline at end of file diff --git a/src/__init__.py b/swf2userSessions/__init__.py similarity index 100% rename from src/__init__.py rename to swf2userSessions/__init__.py diff --git a/swf2userSessions.py b/swf2userSessions/swf2userSessions.py similarity index 97% rename from swf2userSessions.py rename to swf2userSessions/swf2userSessions.py index 00fbe1d..53486b2 100755 --- a/swf2userSessions.py +++ b/swf2userSessions/swf2userSessions.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 -import argparse, json, re, os, sys, warnings -from src.user_session_builder import User -from src.workload import SwfField, Job +import argparse, json, re, os, warnings +from swf2userSessions.user_session_builder import User +from swf2userSessions.workload import SwfField, Job def swf2sessions(input_swf, out_dir, delim_approach, delim_threshold, @@ -108,8 +108,7 @@ def check_sanity(job:Job): return True - -if __name__ == "__main__": +def parse_from_cli(): parser = argparse.ArgumentParser(description="Python script to read a workload trace in the Standard Workload Format (SWF), decompose it into user sessions, analyse the dependencies between sessions and store the results in the Session Annotated Batsim JSON format (SABjson).") parser.add_argument('input_swf', type=argparse.FileType('r'), @@ -230,3 +229,7 @@ if __name__ == "__main__": given_walltime_only=args.given_walltime_only, job_grain=args.job_grain, quiet=args.quiet) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/src/user_session_builder.py b/swf2userSessions/user_session_builder.py similarity index 99% rename from src/user_session_builder.py rename to swf2userSessions/user_session_builder.py index f0ae0d8..30b72cb 100644 --- a/src/user_session_builder.py +++ b/swf2userSessions/user_session_builder.py @@ -5,7 +5,7 @@ according to the delimitation approach. from datetime import datetime import networkx as nx -from src.workload import Session +from swf2userSessions.workload import Session import sys class User: diff --git a/src/workload.py b/swf2userSessions/workload.py similarity index 100% rename from src/workload.py rename to swf2userSessions/workload.py -- GitLab