-
Notifications
You must be signed in to change notification settings - Fork 6
Add arcpro runner #133
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
geogeek11
wants to merge
13
commits into
master
Choose a base branch
from
occamlabsarcpro
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add arcpro runner #133
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
91c4e4a
Add arcpro runner;
geogeek11 ae17353
change repo url to occamlabs branch
geogeek11 400e3a9
replace slugify by python-slugify dep
geogeek11 88bce46
add hum_event param to QGisRunner
geogeek11 2d069ff
Fix the controller to run docker
geogeek11 1b6d943
Add the option to choose a runner;
geogeek11 72475ad
add runner option to README.md
geogeek11 61b058e
Revert "Add the option to choose a runner;"
geogeek11 1d6abd6
Merge branch 'occamlabsarcpro' of https://github.com/mapaction/mapact…
geogeek11 80d3e95
fix controller to run docker
geogeek11 906b2d2
fix function name typo
geogeek11 f70412d
Update README.md
geogeek11 aa461f0
Update README.md
geogeek11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,7 +42,8 @@ def get_lyr_render_extension(self, **kwargs): | |
| 'BaseRunnerPlugin is an abstract class and the `get_lyr_render_extension`' | ||
| ' method cannot be called directly') | ||
|
|
||
| def _get_all_templates_by_regex(self, recipe): | ||
| def _get_all_templates_by_regex(self, recipe): #Todo should we use the layoutManager from project instance | ||
| #to get embeded templates and match the regex against their names | ||
| """ | ||
| Gets the fully qualified filenames of map templates, which exist in `self.cmf.map_templates` whose | ||
| filenames match the regex `recipe.template`. | ||
|
|
@@ -53,25 +54,28 @@ def _get_all_templates_by_regex(self, recipe): | |
| `self.get_projectfile_extension()` | ||
| """ | ||
| def _is_relevant_file(f): | ||
|
|
||
| extension = os.path.splitext(f)[1] | ||
| logger.debug('checking file "{}", with extension "{}", against pattern "{}" and "{}"'.format( | ||
| logger.info('checking file "{}", with extension "{}", against pattern "{}" and "{}"'.format( | ||
| f, extension, recipe.template, self.get_projectfile_extension() | ||
| )) | ||
| if re.search(recipe.template, f): | ||
| logger.debug('file {} matched regex'.format(f)) | ||
| f_path = os.path.join(self.cmf.map_templates, f) | ||
| logger.debug('file {} joined with self.cmf.map_templates "{}"'.format(f, f_path)) | ||
| return (os.path.isfile(f_path)) and (extension == self.get_projectfile_extension()) | ||
| is_relevent = (os.path.isfile(f_path)) and (extension == self.get_projectfile_extension()) | ||
| if(is_relevent): logging.info(f"got relevent {f_path}") | ||
| return is_relevent | ||
| else: | ||
| return False | ||
|
|
||
| # TODO: This results in calling `os.path.join` twice for certain files | ||
| logger.debug('searching for map templates in; {}'.format(self.cmf.map_templates)) | ||
| logger.info('searching for map templates in; {}'.format(self.cmf.map_templates)) | ||
| all_filenames = os.listdir(self.cmf.map_templates) | ||
| logger.debug('all available template files:\n\t{}'.format('\n\t'.join(all_filenames))) | ||
| logger.info('all available template files:\n\t{}'.format('\n\t'.join(all_filenames))) | ||
| relevant_filenames = [os.path.realpath(os.path.join(self.cmf.map_templates, fi)) | ||
| for fi in all_filenames if _is_relevant_file(fi)] | ||
| logger.debug('possible template files:\n\t{}'.format('\n\t'.join(relevant_filenames))) | ||
| logger.info('possible template files:\n\t{}'.format('\n\t'.join(relevant_filenames))) | ||
| return relevant_filenames | ||
|
|
||
| def _get_template_by_aspect_ratio(self, template_aspect_ratios, target_ar): | ||
|
|
@@ -168,10 +172,10 @@ def get_templates(self, **kwargs): | |
|
|
||
| # use `recipe.template` as regex to locate one or more templates | ||
| possible_templates = self._get_all_templates_by_regex(recipe) | ||
|
|
||
| # Select the template with the most appropriate aspect ratio | ||
| possible_aspect_ratios = self.get_aspect_ratios_of_templates(possible_templates, recipe) | ||
|
|
||
| logging.info(f"possible ARio : {possible_aspect_ratios}") | ||
| mf = recipe.get_frame(recipe.principal_map_frame) | ||
| # Default value | ||
| target_aspect_ratio = 1.0 | ||
|
|
@@ -182,7 +186,7 @@ def get_templates(self, **kwargs): | |
| # use logic to workout which template has best aspect ratio | ||
| # obviously not this logic though: | ||
| recipe.template_path = self._get_template_by_aspect_ratio(possible_aspect_ratios, target_aspect_ratio) | ||
|
|
||
| # TODO re-enable "Have the input files changed?" | ||
| # Have the input shapefiles changed? | ||
| return recipe | ||
|
|
@@ -205,7 +209,7 @@ def get_next_map_version_number(self, mapNumberDirectory, mapNumber, mapFileName | |
| versionNumber = versionNumber + 1 | ||
| return versionNumber | ||
|
|
||
| # Is it possible to avoid the need to hardcode the naming convention for the output mxds? Eg could a | ||
| # TODO Is it possible to aviod the need to hardcode the naming convention for the output mxds? Eg could a | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO found |
||
| # String.Template be specified within the Cookbook? | ||
| # https://docs.python.org/2/library/string.html#formatspec | ||
| # https://www.python.org/dev/peps/pep-3101/ | ||
|
|
@@ -277,7 +281,7 @@ def _create_export_dir(self, recipe): | |
|
|
||
| def _do_export(self, export_params, recipe): | ||
| """ | ||
| Note implementing subclasses, must return the dict `export_params`, with | ||
| Note implenmenting subclasses, must return the dict `export_params`, with | ||
| key/value pairs which satisfies the `_check_plugin_supplied_params` method. | ||
| """ | ||
| raise NotImplementedError( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
_get_all_templates_by_regexhas a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.