runem 0.0.11__tar.gz → 0.0.13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,50 @@ Changelog
4
4
 
5
5
  (unreleased)
6
6
  ------------
7
+ - Merge branch 'feat/better_module_find_error_msg' [Frank Harrison]
8
+ - Feat(better-module-msg): improves the information given when loading a
9
+ job address. [Frank Harrison]
10
+
11
+
12
+ 0.0.12 (2023-11-29)
13
+ -------------------
14
+ - Release: version 0.0.12 🚀 [Frank Harrison]
15
+ - Merge branch 'chore/format_yml' [Frank Harrison]
16
+ - Chore(format-yml): reformats the .runem.yml file. [Frank Harrison]
17
+ - Chore(format-yml): adds yml files to the prettier command. [Frank
18
+ Harrison]
19
+
20
+ This means that runems own runem config is reformatted
21
+ - Merge branch 'feat/warn_on_bad_names' [Frank Harrison]
22
+ - Feat(bad-label): errors on bad labels. [Frank Harrison]
23
+
24
+ .. not a massive improvment but really helps clarify what you SHOULD be looking at when things go wrong, which is nice
25
+ - Feat(bad-func-ref-message): gives a better error message on bad
26
+ function references. [Frank Harrison]
27
+
28
+ Specifically when those functions cannot be found inside the file/module
29
+ that they're reference to by the .runem.yml
30
+ - Merge branch 'chore/pretty_json' [Frank Harrison]
31
+ - Chore(pretty-json): prettifies cspell.json. [Frank Harrison]
32
+ - Chore(pretty-json): adds jobs to use prettifier via yarn. [Frank
33
+ Harrison]
34
+
35
+ ... currently this only targets json files
36
+ - Merge branch 'chore/kwargs' [Frank Harrison]
37
+ - Chore(kwargs): makes run_command 'cmd' the first thing as it cannot be
38
+ infered from the runem kwargs. [Frank Harrison]
39
+ - Feat(kwargs): moves to using kwargs by preference when calling jobs.
40
+ [Frank Harrison]
41
+
42
+ ... jobs can then pass those kwargs down to the run_command
43
+ - Chore(kwargs): deletes 0xDEADCODE. [Frank Harrison]
44
+
45
+ This deletes deadcode that was left over from the move out of the lursight codebase
46
+
47
+
48
+ 0.0.11 (2023-11-29)
49
+ -------------------
50
+ - Release: version 0.0.11 🚀 [Frank Harrison]
7
51
  - Merge branch 'fix/warning_when_no_files_for_job' [Frank Harrison]
8
52
  - Fix(warn-no-files): starts troubleshooting. [Frank Harrison]
9
53
  - Fix(warn-no-files): updates README after deleting defunct jobs. [Frank
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: runem
3
- Version: 0.0.11
3
+ Version: 0.0.13
4
4
  Summary: Awesome runem created by lursight
5
5
  Home-page: https://github.com/lursight/runem/
6
6
  Author: lursight
@@ -0,0 +1 @@
1
+ 0.0.13
@@ -16,19 +16,18 @@ def get_stdout(process: subprocess.CompletedProcess, prefix: str) -> str:
16
16
 
17
17
 
18
18
  def run_command( # noqa: C901 # pylint: disable=too-many-branches
19
+ cmd: typing.List[str], # 'cmd' is the only thing that can't be optionally kwargs
19
20
  label: str,
20
- cmd: typing.List[str],
21
21
  verbose: bool,
22
22
  env_overrides: typing.Optional[dict] = None,
23
23
  ignore_fails: bool = False,
24
24
  valid_exit_ids: typing.Optional[typing.Tuple[int, ...]] = None,
25
+ **kwargs: typing.Any,
25
26
  ) -> str:
26
27
  """Runs the given command, returning stdout or throwing on any error."""
27
28
  cmd_string: str = " ".join(cmd)
28
29
  if verbose:
29
- print("runem: test: " + "=" * TERMINAL_WIDTH)
30
- print(f"runem: test: {label}")
31
- print(f"{cmd_string}")
30
+ print(f"runem: running: start: {label}: {cmd_string}")
32
31
  if valid_exit_ids is not None:
33
32
  valid_exit_strs = ",".join([str(exit_code) for exit_code in valid_exit_ids])
34
33
  print(f"allowed return ids are: {valid_exit_strs}")
@@ -68,9 +67,6 @@ def run_command( # noqa: C901 # pylint: disable=too-many-branches
68
67
  if run_env:
69
68
  run_env_param = run_env
70
69
 
71
- if verbose:
72
- print("runem: test: " + "=" * TERMINAL_WIDTH)
73
-
74
70
  process: subprocess.CompletedProcess
75
71
  try:
76
72
  process = subprocess.run(
@@ -110,5 +106,5 @@ def run_command( # noqa: C901 # pylint: disable=too-many-branches
110
106
  cmd_stdout: str = get_stdout(process, prefix=label)
111
107
  if verbose:
112
108
  print(cmd_stdout)
113
-
109
+ print(f"runem: running: done: {label}: {cmd_string}")
114
110
  return cmd_stdout
@@ -630,11 +630,12 @@ def _run_job(
630
630
  function(args, options, file_list)
631
631
  else:
632
632
  function(
633
- options, # type: ignore
634
- file_list, # type: ignore
633
+ options=options, # type: ignore
634
+ file_list=file_list, # type: ignore
635
635
  procs=args.procs,
636
636
  root_path=root_path,
637
637
  verbose=args.verbose,
638
+ **job_config,
638
639
  )
639
640
  end = timer()
640
641
  time_taken: timedelta = timedelta(seconds=end - start)
@@ -644,7 +645,7 @@ def _run_job(
644
645
 
645
646
 
646
647
  def _get_test_function(
647
- cfg_filepath: typing.Optional[pathlib.Path],
648
+ cfg_filepath: pathlib.Path,
648
649
  module_name: str,
649
650
  module_file_path: pathlib.Path,
650
651
  function_to_load: str,
@@ -664,7 +665,16 @@ def _get_test_function(
664
665
  if not module_spec.loader:
665
666
  raise FunctionNotFound("unable to load module")
666
667
  module_spec.loader.exec_module(module)
667
- function: JobFunction = getattr(module, function_to_load)
668
+ try:
669
+ function: JobFunction = getattr(module, function_to_load)
670
+ except AttributeError as err:
671
+ raise FunctionNotFound(
672
+ (
673
+ f"ERROR! Check that function '{function_to_load}' "
674
+ f"exists in '{module_file_path}' as expected in "
675
+ f"your config at '{str(cfg_filepath)}"
676
+ )
677
+ ) from err
668
678
  return function
669
679
 
670
680
 
@@ -696,9 +706,19 @@ def get_test_function(job_config: JobConfig, cfg_filepath: pathlib.Path) -> JobF
696
706
  Also re-address the job-config.
697
707
  """
698
708
  function_to_load: str = job_config["addr"]["function"]
699
- module_file_path: pathlib.Path = _find_job_module(
700
- cfg_filepath, job_config["addr"]["file"]
701
- )
709
+ try:
710
+ module_file_path: pathlib.Path = _find_job_module(
711
+ cfg_filepath, job_config["addr"]["file"]
712
+ )
713
+ except FunctionNotFound as err:
714
+ raise FunctionNotFound(
715
+ (
716
+ f"Whilst loading job '{job_config['label']}' runem failed to find "
717
+ f"job.addr.file '{job_config['addr']['file']}' looking for "
718
+ f"job.addr.function '{function_to_load}'"
719
+ )
720
+ ) from err
721
+
702
722
  module_name = module_file_path.stem.replace(" ", "_").replace("-", "_")
703
723
 
704
724
  try:
@@ -856,10 +876,17 @@ def _parse_job_config(
856
876
  Returns the tags generated
857
877
  """
858
878
  try:
879
+ job_names_used = job["label"] in in_out_job_names
880
+ if job_names_used:
881
+ print("ERROR: duplicate job label!")
882
+ print(f"\t'{job['label']}' is used twice or more in {str(cfg_filepath)}")
883
+ sys.exit(1)
884
+
859
885
  # try and load the function _before_ we schedule it's execution
860
886
  get_test_function(job, cfg_filepath)
861
887
  phase_id: PhaseName = job["when"]["phase"]
862
888
  in_out_jobs_by_phase[phase_id].append(job)
889
+
863
890
  in_out_job_names.add(job["label"])
864
891
  in_out_phases.add(job["when"]["phase"])
865
892
  for tag in job["when"]["tags"]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: runem
3
- Version: 0.0.11
3
+ Version: 0.0.13
4
4
  Summary: Awesome runem created by lursight
5
5
  Home-page: https://github.com/lursight/runem/
6
6
  Author: lursight
@@ -1 +0,0 @@
1
- 0.0.11
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes