Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
cchall committed Aug 2, 2022
2 parents 3f5a2f9 + f7ab7e4 commit f98def6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
11 changes: 6 additions & 5 deletions rsopt/configuration/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pickle
import typing
import pathlib
import sirepo.lib
from rsopt import util
from rsopt.codes import _TEMPLATED_CODES
from rsopt import _SETUP_SCHEMA
Expand Down Expand Up @@ -68,7 +67,7 @@ def _validate_execution_type(key):
return False


def _shifter_parse_model(name: str, input_file: str, ignored_files: list) -> sirepo.lib.SimData or None:
def _shifter_parse_model(name: str, input_file: str, ignored_files: list) -> typing.Type['sirepo.lib.SimData'] or None:
# Sidesteps the difficulty of Sirepo install on NERSC by running a script that parses to the Sirepo model
import shlex
from subprocess import Popen, PIPE
Expand Down Expand Up @@ -149,7 +148,8 @@ def templated(cls):

@classmethod
def parse_input_file(cls, input_file: str, shifter: str,
ignored_files: typing.Optional[typing.List[str]] = None) -> sirepo.lib.SimData or None:
ignored_files: typing.Optional[typing.List[str]] = None) -> typing.Type['sirepo.lib.SimData'] \
or None:

if shifter:
# Must pass a list to ignored_files here since it is sent to subprocess
Expand Down Expand Up @@ -295,7 +295,8 @@ def generate_input_file(self, kwarg_dict, directory):
for k in dict_item_str.keys():
kwarg_dict.pop(k)

output_template = template.render(dict_item=kwarg_dict, dict_item_str=dict_item_str, full_input_file_path=self.setup['input_file'],
output_template = template.render(dict_item=kwarg_dict, dict_item_str=dict_item_str,
full_input_file_path=self.setup['input_file'],
function=self.setup['function'])

file_path = os.path.join(directory, _PARALLEL_PYTHON_RUN_FILE)
Expand Down Expand Up @@ -527,4 +528,4 @@ def generate_input_file(self, kwarg_dict, directory):
'opal': Opal,
'user': User,
'genesis': Genesis
}
}
1 change: 1 addition & 0 deletions rsopt/package_data/shifter_sirepo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""Script is called inside Shifter container with Sirepo installed and returns parsed model information"""
import pickle
import sys
import sirepo.lib
Expand Down
5 changes: 3 additions & 2 deletions rsopt/pkcli/pack.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import rsopt.parse as parse
import sirepo.sim_data # Can't run import sirepo and call sirepo.sim_data. ??
import modulefinder
import tarfile
import pathlib
import os
from sirepo.template import lattice


def _get_local_modules(script_name):
Expand Down Expand Up @@ -32,6 +30,9 @@ def _get_processing(job):


def _get_file_list_from_model(model, code_name, input_file_path):
import sirepo.sim_data
from sirepo.template import lattice

# Use same path as configuration file when packing
model_path = pathlib.Path(input_file_path).parents[0]
# Get input and lattice if exists
Expand Down

0 comments on commit f98def6

Please sign in to comment.