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

Issue/105/abs path profile #106

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fink_mm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = "0.16.11"
__version__ = "0.16.12"
__distribution_schema_version__ = "1.3"
__observatory_schema_version__ = "1.1"
1 change: 1 addition & 0 deletions fink_mm/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

@pytest.fixture(autouse=True)
def init_test(doctest_namespace):
doctest_namespace["os"] = os
doctest_namespace["pd"] = pandas
doctest_namespace["tempfile"] = tempfile
doctest_namespace["assert_frame_equal"] = assert_frame_equal
Expand Down
18 changes: 14 additions & 4 deletions fink_mm/utils/fun_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,8 +860,13 @@ def read_and_build_spark_submit(config, logger):
--------
>>> config = get_config({"--config" : "fink_mm/conf/fink_mm.conf"})
>>> logger = init_logging()
>>> read_and_build_spark_submit(config, logger)
"if test -f '~/.bash_profile'; then source ~/.bash_profile; fi; `which spark-submit` --master local[2] --conf spark.mesos.principal= --conf spark.mesos.secret= --conf spark.mesos.role= --conf spark.executorEnv.HOME=/path/to/user/ --driver-memory 4G --executor-memory 8G --conf spark.cores.max=16 --conf spark.executor.cores=8"
>>> spark_str = read_and_build_spark_submit(config, logger)

>>> home_path = os.environ["HOME"]
>>> path_bash_profile = os.path.join(home_path, ".bash_profile")
>>> test_str = f"if test -f '{path_bash_profile}'; then source {path_bash_profile}; fi; `which spark-submit` --master local[2] --conf spark.mesos.principal= --conf spark.mesos.secret= --conf spark.mesos.role= --conf spark.executorEnv.HOME=/path/to/user/ --driver-memory 4G --executor-memory 8G --conf spark.cores.max=16 --conf spark.executor.cores=8"
>>> test_str == spark_str
True
"""
try:
master_manager = config["STREAM"]["manager"]
Expand All @@ -877,8 +882,11 @@ def read_and_build_spark_submit(config, logger):
logger.error("Spark Admin config entry not found \n\t {}".format(e))
exit(1)

spark_submit = "if test -f '~/.bash_profile'; then \
source ~/.bash_profile; fi; \
home_path = os.environ["HOME"]
path_bash_profile = os.path.join(home_path, ".bash_profile")

spark_submit = "if test -f '{}'; then \
source {}; fi; \
`which spark-submit` \
--master {} \
--conf spark.mesos.principal={} \
Expand All @@ -889,6 +897,8 @@ def read_and_build_spark_submit(config, logger):
--executor-memory {}G \
--conf spark.cores.max={} \
--conf spark.executor.cores={}".format(
path_bash_profile,
path_bash_profile,
master_manager,
principal_group,
secret,
Expand Down
Loading