Commit 23915c74 authored by tchervec's avatar tchervec
Browse files

Resolve "upgrade to JDK 11"

parent 74ca8951
......@@ -7,7 +7,7 @@ test:
- conda list
- which python
- python --version
- python -u -v -m synpp config_gitlab.yml
- python -u -m synpp config_gitlab.yml
- rm -rf env
- Update to `java 11.0.x`
- Update environment set-up on servers
- Refactor IPU fitting
- Impute canton id directly from shapefile
import numpy as np
def configure(context):
def execute(context):
df = context.stage("data.statpop.scaled")
if "input_downsampling" in context.config:
# If we do not want to downsample, set the value to 1.0 in config
probability = context.config("input_downsampling")
if probability < 1.0:
print("Downsampling (%f)" % probability)
household_ids = np.unique(df["household_id"])
......@@ -18,7 +23,7 @@ def execute(context):
# during downsampling, households are selected randomly without specifying a seed,
# which means that running the pipeline twice will produce different populations
# resulting in potentially different simulation results
f = np.random.random(size = (len(household_ids),)) < probability
f = np.random.random(size=(len(household_ids),)) < probability
remaining_household_ids = household_ids[f]
print(" Sampled number of households:", len(remaining_household_ids))
import subprocess as sp
class JavaRunner:
def __init__(self, binary, memory):
self.memory = memory
self.binary = binary
def __call__(self, classpath, entry_point, arguments, vm_arguments = None, cwd = None, memory = None, output = False):
def __call__(self, classpath, entry_point, arguments, vm_arguments=None, cwd=None, memory=None, output=False):
memory = self.memory if memory is None else memory
if vm_arguments is None:
......@@ -22,9 +23,10 @@ class JavaRunner:
print(" " + " ".join(command_line))
if output:
return sp.check_output(command_line, cwd = cwd)
return sp.check_output(command_line, cwd=cwd)
return sp.check_call(command_line, cwd = cwd)
return sp.check_call(command_line, cwd=cwd)
def configure(context):
context.config("java_memory", "10G")
......@@ -33,7 +35,8 @@ def configure(context):
# Not ideal, because we assume that "java" is the right binary.
# This should better go into a "validate" step between configure and
# execute ... TODO
assert("1.8.0" in sp.check_output(["java", "-version"], stderr = sp.STDOUT).decode("utf-8"))
assert ("11.0" in sp.check_output(["java", "-version"], stderr=sp.STDOUT).decode("utf-8"))
def execute(context):
return JavaRunner(context.config("java_binary"), context.config("java_memory"))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment