Skip to content

Commit

Permalink
Merge pull request #3010 from Unity-Technologies/release-0.12.0-to-ma…
Browse files Browse the repository at this point in the history
…ster

Merge Release 0.12.0 to master
  • Loading branch information
Chris Elion authored Dec 2, 2019
2 parents 8a08bc4 + 6a28088 commit 164d1ab
Show file tree
Hide file tree
Showing 344 changed files with 5,552 additions and 15,006 deletions.
27 changes: 25 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ jobs:


markdown_link_check:
parameters:
precommit_command:
type: string
description: precommit hook to run
default: markdown-link-check
docker:
- image: circleci/node:12.6.0
working_directory: ~/repo
Expand Down Expand Up @@ -117,7 +122,7 @@ jobs:
name: Run markdown-link-check via precommit
command: |
. venv/bin/activate
pre-commit run --hook-stage manual markdown-link-check --all-files
pre-commit run --hook-stage manual << parameters.precommit_command >> --all-files
protobuf_generation_check:
docker:
Expand Down Expand Up @@ -223,7 +228,13 @@ workflows:
executor: python373
pyversion: 3.7.3
# Test python 3.7 with the newest supported versions
pip_constraints: test_constraints_max_version.txt
pip_constraints: test_constraints_max_tf1_version.txt
- build_python:
name: python_3.7.3+tf2
executor: python373
pyversion: 3.7.3
# Test python 3.7 with the newest supported versions
pip_constraints: test_constraints_max_tf2_version.txt
- markdown_link_check
- protobuf_generation_check
- deploy:
Expand All @@ -250,3 +261,15 @@ workflows:
only: /[0-9]+(\.[0-9]+)*(\.dev[0-9]+)*/
branches:
ignore: /.*/
nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- develop
jobs:
- markdown_link_check:
name: markdown-link-check full
precommit_command: markdown-link-check-full
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
/UnitySDK/[Bb]uild/
/UnitySDK/[Bb]uilds/
/UnitySDK/[Pp]ackages/
/UnitySDK/[Uu]nity[Pp]ackage[Mm]anager/
/UnitySDK/Assets/AssetStoreTools*
/UnitySDK/Assets/Plugins*
/UnitySDK/Assets/Demonstrations*
Expand Down
37 changes: 30 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
)$
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.720
rev: v0.740
hooks:
- id: mypy
name: mypy-ml-agents
Expand All @@ -28,7 +28,7 @@ repos:
args: [--ignore-missing-imports, --disallow-incomplete-defs]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
rev: v2.4.0
hooks:
- id: mixed-line-ending
exclude: >
Expand All @@ -44,17 +44,33 @@ repos:
.*_pb2.py|
.*_pb2_grpc.py
)$
# temporarily pin flake8-comprehensions
additional_dependencies: [flake8-comprehensions==3.0.1]
# flake8-tidy-imports is used for banned-modules, not actually tidying
additional_dependencies: [flake8-comprehensions, flake8-tidy-imports]
- id: trailing-whitespace
name: trailing-whitespace-markdown
types: [markdown]
- id: check-merge-conflict
args: [--assume-in-merge]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.4.1 # Use the ref you want to point at
rev: v1.4.2
hooks:
- id: python-check-mock-methods



- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.4.4
hooks:
- id: pylint
exclude: >
(?x)^(
.*_pb2.py|
.*_pb2_grpc.py|
.*/tests/.*
)$
args: [--score=n]

# "Local" hooks, see https://pre-commit.com/#repository-local-hooks
- repo: local
hooks:
Expand All @@ -63,15 +79,22 @@ repos:
# markdown-link-check doesn't support multiple files on the commandline, so this hacks around that.
# Note that you must install the package separately via npm. For example:
# brew install npm; npm install -g markdown-link-check
entry: bash -xc 'echo "$@" | xargs -n1 -t markdown-link-check -c markdown-link-check.config.json' --
entry: bash -xc 'echo "$@" | xargs -n1 -t markdown-link-check -c markdown-link-check.fast.json' --
language: system
types: [markdown]
# Don't check localized files since their target might not be localized.
exclude: ".*localized.*"
# Only run manually, e.g. pre-commit run --hook-stage manual markdown-link-check
stages: [manual]
- id: markdown-link-check-full
name: markdown-link-check-full
entry: bash -xc 'echo "$@" | xargs -n1 -t markdown-link-check -c markdown-link-check.full.json' --
language: system
types: [markdown]
exclude: ".*localized.*"
stages: [manual]
- id: validate-versions
name: validate library versions
language: script
entry: utils/validate_versions.py
files: ".*/setup.py"
files: ".*/__init__.py"
43 changes: 43 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[MASTER]
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS

[MESSAGES CONTROL]
#enable=

disable =
# C0301: Line too long
# C0330: Wrong hanging indentation before block
# disabled because black handles this
C0301,C0330,

# C0114: Missing module docstring
# C0115: Missing class docstring
# C0116: Missing function or method docstring
C0114,C0115,C0116,

# All convention and refactor for now
C,R,

# W1201: Specify string format arguments as logging function parameters
# W1202: Use % formatting in logging functions and pass the % parameters as arguments
W1201,W1202,

# W0612: Unused variable
# W0613: Unused argument
W0612, W0613,

# W0107: Unnecessary pass statement
W0107,

# W0511 "TODO"
W0511,

# W0703: Catching too general exception Exception
W0703,

# E0401: Unable to import...
# E0611: No name '...' in module '...'
# need to look into these, probably namespace packages
E0401, E0611
9 changes: 2 additions & 7 deletions .yamato/csharp-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,17 @@ test_mac_editmode_{{ editor.version }}:
name: Test Mac EditMode {{ editor.version }}
agent:
type: Unity::VM::osx
image: ml-agents/ml-agents-bokken-mac:release
image: ml-agents/ml-agents-bokken-mac:v0.1.2-440635
flavor: i1.small
variables:
UNITY_VERSION: {{ editor.version }}
commands:
- ./run-tests-editmode-osx-editor.sh
triggers:
branches:
only:
- "/develop-.*/"
targets:
only:
- "develop"
pull_requests:
- targets:
only:
- "develop"
- "master"
- "/release-.*/"
- "/hotfix-.*/"
Expand Down
11 changes: 3 additions & 8 deletions .yamato/standalone-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,18 @@ test_mac_standalone_{{ editor.version }}:
name: Test Mac Standalone {{ editor.version }}
agent:
type: Unity::VM::osx
image: ml-agents/ml-agents-bokken-mac:release
image: ml-agents/ml-agents-bokken-mac:v0.1.2-440635
flavor: i1.small
variables:
UNITY_VERSION: {{ editor.version }}
commands:
- ./run-standalone-build-osx.sh
triggers:
branches:
only:
- "/develop-.*/"
targets:
only:
- "develop"
pull_requests:
- targets:
only:
- "develop"
- "master"
- "/release-.*/"
- "/hotfix-.*/"
{% endfor %}
{% endfor %}
1 change: 0 additions & 1 deletion UnitySDK/Assets/ML-Agents/Editor/AgentEditor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using UnityEngine;
using UnityEditor;
using Barracuda;

namespace MLAgents
{
Expand Down
31 changes: 17 additions & 14 deletions UnitySDK/Assets/ML-Agents/Editor/BehaviorParametersEditor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using UnityEngine;
using UnityEditor;
using Barracuda;
using MLAgents.Sensor;

namespace MLAgents
{
Expand All @@ -11,41 +12,41 @@ This code is meant to modify the behavior of the inspector on Agent Components.
[CanEditMultipleObjects]
public class BehaviorParametersEditor : Editor
{
private const float k_TimeBetweenModelReloads = 2f;
const float k_TimeBetweenModelReloads = 2f;
// Time since the last reload of the model
private float m_TimeSinceModelReload;
float m_TimeSinceModelReload;
// Whether or not the model needs to be reloaded
private bool m_RequireReload;
bool m_RequireReload;

public override void OnInspectorGUI()
{
var serializedObject = base.serializedObject;
serializedObject.Update();
var so = serializedObject;
so.Update();

// Drawing the Behavior Parameters
EditorGUI.BeginChangeCheck();
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_BehaviorName"));
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_BrainParameters"), true);
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Model"), true);
EditorGUILayout.PropertyField(so.FindProperty("m_BehaviorName"));
EditorGUILayout.PropertyField(so.FindProperty("m_BrainParameters"), true);
EditorGUILayout.PropertyField(so.FindProperty("m_Model"), true);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_InferenceDevice"), true);
EditorGUILayout.PropertyField(so.FindProperty("m_InferenceDevice"), true);
EditorGUI.indentLevel--;
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_UseHeuristic"));
EditorGUILayout.PropertyField(so.FindProperty("m_BehaviorType"));
// EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Heuristic"), true);
EditorGUI.indentLevel--;
if (EditorGUI.EndChangeCheck())
{
m_RequireReload = true;
}
DisplayFailedModelChecks();
serializedObject.ApplyModifiedProperties();
so.ApplyModifiedProperties();
}

/// <summary>
/// Must be called within OnEditorGUI()
/// </summary>
private void DisplayFailedModelChecks()
void DisplayFailedModelChecks()
{
if (m_RequireReload && m_TimeSinceModelReload > k_TimeBetweenModelReloads)
{
Expand All @@ -56,15 +57,17 @@ private void DisplayFailedModelChecks()
D.logEnabled = false;
Model barracudaModel = null;
var model = (NNModel)serializedObject.FindProperty("m_Model").objectReferenceValue;
var brainParameters = ((BehaviorParameters)target).brainParameters;
var behaviorParameters = (BehaviorParameters)target;
var sensorComponents = behaviorParameters.GetComponents<SensorComponent>();
var brainParameters = behaviorParameters.brainParameters;
if (model != null)
{
barracudaModel = ModelLoader.Load(model.Value);
}
if (brainParameters != null)
{
var failedChecks = InferenceBrain.BarracudaModelParamLoader.CheckModel(
barracudaModel, brainParameters);
barracudaModel, brainParameters, sensorComponents);
foreach (var check in failedChecks)
{
if (check != null)
Expand Down
Loading

0 comments on commit 164d1ab

Please sign in to comment.