Skip to content

Snactor: add command to show dependencies between actors #897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

MichalHe
Copy link
Member

Adds a new command show-dependencies <workflow> that displays all producer/consumer dependencies in the workflow. The output of the command is in the DOT language that allows easy visualization of graphs.

Example use:

# snactor show-dependencies WORKFLOW > deps.dot
# xdot deps.dot

Copy link

Thank you for contributing to the Leapp project!

Please note that every PR needs to comply with the Leapp Guidelines and must pass all tests in order to be mergeable.
If you want to request a review or rebuild a package in copr, you can use following commands as a comment:

  • review please @oamg/developers to notify leapp developers of the review request
  • /packit copr-build to submit a public copr build using packit

To launch regression testing public members of oamg organization can leave the following comment:

  • /rerun to schedule basic regression tests using this pr build and leapp-repository*main* as artifacts
  • /rerun 42 to schedule basic regression tests using this pr build and leapp-repository*PR42* as artifacts
  • /rerun-sst to schedule sst tests using this pr build and leapp-repository*main* as artifacts
  • /rerun-sst 42 to schedule sst tests using this pr build and leapp-repository*PR42* as artifacts

Please open ticket in case you experience technical problem with the CI. (RH internal only)

Note: In case there are problems with tests not being triggered automatically on new PR/commit or pending for a long time, please consider rerunning the CI by commenting leapp-ci build (might require several comments). If the problem persists, contact leapp-infra.

@MichalHe MichalHe force-pushed the snactor_show_dependencies branch 3 times, most recently from 3b648e8 to ebd5656 Compare April 23, 2025 21:00
Introduce a new command 'show-dependencies' that prints producent/
consumer dependencies between all actors in a given workflow in the DOT
format that allows easy visualization.
@MichalHe MichalHe force-pushed the snactor_show_dependencies branch from ebd5656 to f7e5e24 Compare April 23, 2025 21:10

workflow = repository.lookup_workflow(params.workflow_name)
if not workflow:
raise CommandError('Could not find any workflow named "{}"'.format(params.name))
Copy link
Member

@pirat89 pirat89 Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# snactor show-dependencies IPUConfig
Traceback (most recent call last):
  File "/usr/bin/snactor", line 11, in <module>
    load_entry_point('leapp==0.18.0', 'console_scripts', 'snactor')()
  File "/usr/lib/python3.6/site-packages/leapp/snactor/__init__.py", line 79, in main
    cli.command.execute(version=_('snactor version {}').format(VERSION))
  File "/usr/lib/python3.6/site-packages/leapp/utils/clicmd.py", line 111, in execute
    args.func(args)
  File "/usr/lib/python3.6/site-packages/leapp/utils/clicmd.py", line 133, in called
    self.target(args)
  File "/usr/lib/python3.6/site-packages/leapp/utils/repository.py", line 20, in checker
    return f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/leapp/snactor/context.py", line 34, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/leapp/snactor/commands/show_dependencies.py", line 36, in cli
    raise CommandError('Could not find any workflow named "{}"'.format(params.name))
AttributeError: 'Namespace' object has no attribute 'name'

Possibly workflow_name?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, should be fixed (untested, will test in a moment).

@MichalHe MichalHe force-pushed the snactor_show_dependencies branch from 694dca1 to f9680cc Compare April 24, 2025 20:45
@pirat89
Copy link
Member

pirat89 commented Apr 24, 2025

@MichalHe thinking about the current implementation, it seems to me that it would fit more as sub-command for the workflow command, like:

$ snactor workflow show-dependencies

as snactor (and leapp) can works also without workflows at all, but currently it's connected strictly to workflow. If we want to have it as the main command, I would expect maybe something like this:

snactor show-dependencies  # nothing else - print dependencies for all actors discovered in the leapp repository
snactor show-dependencies --all # cover also actors in referenced repositories
snactor show-dependencies --workflow <WORKFLOW>  # like --all but filter everything based on the specified workflow

wdyt?

@MichalHe
Copy link
Member Author

MichalHe commented Apr 24, 2025

@pirat89 You are right with having a subcommand of workflow would be better. I will move the code into the workflow command.

What I also wish to do is to collect actors from multiple repositories, not just the repository defined at ., because this feature is a bit useless if the actor I am developing lives in el8to9, but all of its dependencies are in common. Perhaps, is there a part of snactor's codebase that I could use as an example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants