Skip to content
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

Production bundles: new options for MC and target machine path #1598

Merged

Conversation

avanwinkle
Copy link
Collaborator

@avanwinkle avanwinkle commented Sep 22, 2021

This PR makes three additions to the fabulous production bundle behavior.

Production bundle building without MC

This PR adds support for the argument -b when running mpf build production_bundle, which builds an MPF bundle only. The -b arg was chosen because that's the argument used to run MPF without connecting to a BCP host—effectively, how you run MPF without an MC.

Explicit machine paths for production bundles

A side-effect of how the production bundles are built—loading all the config files and pickling them—is that the bundle is saved with the machine_path of the machine that generated the bundle. This causes trouble when trying to distribute a bundle to other machines with different file structures. This PR adds a new command argument --dest-path=<machine_path> which will generate the config data and then overwrite the machine_path with the explicitly-provided path.

The machine path is a private variable, so this PR also adds a method set_machine_path(pathname) to the config loader.

Running production bundles without /config

This PR adds support for running an MPF machine from a production bundle without any other file structure requirements. Currently, MPF will always check for a machine folder by looking for the /config folder. When running production bundles this folder is not used, so this PR makes it not required.


# If the production arg was pulled here, re-insert it to the remaining args
# so that the game parser also knows to run in production mode.
if args.production:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A quirk of the parse_known_args() method is that it consumes the known args and only passes unknown args to the next consumer. In this case I need both init.py and game.py to consume the -P arg.

I looked through the parser documentation and didn't see any way to keep an arg in both places, so here I re-add it so that game.py can consume it. Totally open to a better approach!

@avanwinkle
Copy link
Collaborator Author

@jabdoa2 I'm getting consistent integration test failures on Python 3.8 with unfinished futures. Could this be related to your recent work in the area? (162f4e4)

@avanwinkle avanwinkle changed the title Production bundles without MC Production bundles: new options for MC and target machine path Sep 24, 2021
@jabdoa2
Copy link
Collaborator

jabdoa2 commented Sep 24, 2021

Yeah. I will have a look. I catch some cases in tests where we do not cancel futures properly.

@sonarcloud
Copy link

sonarcloud bot commented Sep 26, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jabdoa2
Copy link
Collaborator

jabdoa2 commented Sep 26, 2021

I need to look further into this. Feel free to merge this anyway. Something looks slightly different in Python 3.8 on Windows. The warning is harmless on its own.

@avanwinkle avanwinkle merged commit f2c4601 into missionpinball:dev Sep 26, 2021
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