The current implementation of Python Embedding is to import the user's script and then look for the required variables, e.g. met_data, to read data and attributes. This requires the logic to populate these variables to be run when the script is imported. This has been discovered to be problematic for scripts that use multiprocessing, as that logic should be executed when the script is executed, e.g. not called upon import but called when the script is run (__name__ == '__main__'). This paradigm also restricts how the scripts can be used for other purposes. For example, one cannot include useful functions that can imported into other scripts for use outside of Python Embedding if the logic is run when it is imported.
Describe the Enhancement
Review and enhance the existing logic so that it will work if the script is run instead of just imported. We will need to ensure backwards compatibility so that existing Python Embedding scripts still work.
Time Estimate
Estimate the amount of work required here.
Issues should represent approximately 1 to 3 days of work.
Sub-Issues
Consider breaking the enhancement down into sub-issues.
Relevant Deadlines
List relevant project deadlines here or state NONE.
Funding Source
Define the source of funding and account keys here or state NONE.
Define the Metadata
Assignee
Labels
Milestone and Projects
Define Related Issue(s)
Consider the impact to the other METplus components.
Enhancement Checklist
See the METplus Workflow for details.
The current implementation of Python Embedding is to import the user's script and then look for the required variables, e.g.
met_data, to read data and attributes. This requires the logic to populate these variables to be run when the script is imported. This has been discovered to be problematic for scripts that use multiprocessing, as that logic should be executed when the script is executed, e.g. not called upon import but called when the script is run (__name__ == '__main__'). This paradigm also restricts how the scripts can be used for other purposes. For example, one cannot include useful functions that can imported into other scripts for use outside of Python Embedding if the logic is run when it is imported.Describe the Enhancement
Review and enhance the existing logic so that it will work if the script is run instead of just imported. We will need to ensure backwards compatibility so that existing Python Embedding scripts still work.
Time Estimate
Estimate the amount of work required here.
Issues should represent approximately 1 to 3 days of work.
Sub-Issues
Consider breaking the enhancement down into sub-issues.
Relevant Deadlines
List relevant project deadlines here or state NONE.
Funding Source
Define the source of funding and account keys here or state NONE.
Define the Metadata
Assignee
Labels
Milestone and Projects
Define Related Issue(s)
Consider the impact to the other METplus components.
Enhancement Checklist
See the METplus Workflow for details.
Branch name:
feature_<Issue Number>_<Description>Pull request:
feature <Issue Number> <Description>Select: Reviewer(s) and Development issue
Select: Milestone as the next official version
Select: MET-X.Y Development project for development toward the next coordinated release