@staticmethod
def convertTrial(trial):
    assignments = []
    for assignment in trial.spec.parameter_assignments.assignments:
        assignments.append(Assignment.convert(assignment))
    metric_name = trial.spec.objective.objective_metric_name
    (target_metric, additional_metrics) = Metric.convert(trial.status.observation, metric_name)
    if (target_metric is not None):
        trial = Trial(trial.name, assignments, target_metric, metric_name, additional_metrics)
        return trial
    return None
@staticmethod
def convertTrial(trial):
    assignments = []
    for assignment in trial.spec.parameter_assignments.assignments:
        assignments.append(Assignment.convert(assignment))
    metric_name = trial.spec.objective.objective_metric_name
    (target_metric, additional_metrics) = Metric.convert(trial.status.observation, metric_name)
    if (target_metric is not None):
        trial = Trial(trial.name, assignments, target_metric, metric_name, additional_metrics)
        return trial
    return None