text:
#==============================================================================#
# EMR.jl
#
# This file is generated from:
# https://github.com/aws/aws-sdk-js/blob/master/apis/elasticmapreduce-2009-03-31.normal.json
#==============================================================================#

__precompile__()

module EMR

using AWSCore

"""
    using AWSSDK.EMR.add_instance_fleet
    add_instance_fleet([::AWSConfig], arguments::Dict)
    add_instance_fleet([::AWSConfig]; ClusterId=, InstanceFleet=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "AddInstanceFleet", arguments::Dict)
    elasticmapreduce([::AWSConfig], "AddInstanceFleet", ClusterId=, InstanceFleet=)

# AddInstanceFleet Operation

Adds an instance fleet to a running cluster.

**Note**
> The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x.

# Arguments

## `ClusterId = ::String` -- *Required*
The unique identifier of the cluster.

## `InstanceFleet = [ ... ]` -- *Required*
Specifies the configuration of the instance fleet.
```
 InstanceFleet = [
        "Name" =>  ::String,
        "InstanceFleetType" => <required> "MASTER", "CORE" or "TASK",
        "TargetOnDemandCapacity" =>  ::Int,
        "TargetSpotCapacity" =>  ::Int,
        "InstanceTypeConfigs" =>  [[
            "InstanceType" => <required> ::String,
            "WeightedCapacity" =>  ::Int,
            "BidPrice" =>  ::String,
            "BidPriceAsPercentageOfOnDemandPrice" =>  double,
            "EbsConfiguration" =>  [
                "EbsBlockDeviceConfigs" =>  [[
                    "VolumeSpecification" => <required> [
                        "VolumeType" => <required> ::String,
                        "Iops" =>  ::Int,
                        "SizeInGB" => <required> ::Int
                    ],
                    "VolumesPerInstance" =>  ::Int
                ], ...],
                "EbsOptimized" =>  ::Bool
            ],
            "Configurations" =>  [[
                "Classification" =>  ::String,
                "Configurations" =>  list,
                "Properties" =>  ::Dict{String,String}
            ], ...]
        ], ...],
        "LaunchSpecifications" =>  ["SpotSpecification" => <required> [
                "TimeoutDurationMinutes" => <required> ::Int,
                "TimeoutAction" => <required> "SWITCH_TO_ON_DEMAND" or "TERMINATE_CLUSTER",
                "BlockDurationMinutes" =>  ::Int
            ]]
    ]
```

# Returns

`AddInstanceFleetOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/AddInstanceFleet)
"""
@inline add_instance_fleet(aws::AWSConfig=default_aws_config(); args...) = add_instance_fleet(aws, args)

@inline add_instance_fleet(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "AddInstanceFleet", args)

@inline add_instance_fleet(args) = add_instance_fleet(default_aws_config(), args)

"""
    using AWSSDK.EMR.add_instance_groups
    add_instance_groups([::AWSConfig], arguments::Dict)
    add_instance_groups([::AWSConfig]; InstanceGroups=, JobFlowId=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "AddInstanceGroups", arguments::Dict)
    elasticmapreduce([::AWSConfig], "AddInstanceGroups", InstanceGroups=, JobFlowId=)

# AddInstanceGroups Operation

Adds one or more instance groups to a running cluster.

# Arguments

## `InstanceGroups = [[ ... ], ...]` -- *Required*
Instance groups to add.
```
 InstanceGroups = [[
        "Name" =>  ::String,
        "Market" =>  "ON_DEMAND" or "SPOT",
        "InstanceRole" => <required> "MASTER", "CORE" or "TASK",
        "BidPrice" =>  ::String,
        "InstanceType" => <required> ::String,
        "InstanceCount" => <required> ::Int,
        "Configurations" =>  [[
            "Classification" =>  ::String,
            "Configurations" =>  list,
            "Properties" =>  ::Dict{String,String}
        ], ...],
        "EbsConfiguration" =>  [
            "EbsBlockDeviceConfigs" =>  [[
                "VolumeSpecification" => <required> [
                    "VolumeType" => <required> ::String,
                    "Iops" =>  ::Int,
                    "SizeInGB" => <required> ::Int
                ],
                "VolumesPerInstance" =>  ::Int
            ], ...],
            "EbsOptimized" =>  ::Bool
        ],
        "AutoScalingPolicy" =>  [
            "Constraints" => <required> [
                "MinCapacity" => <required> ::Int,
                "MaxCapacity" => <required> ::Int
            ],
            "Rules" => <required> [[
                "Name" => <required> ::String,
                "Description" =>  ::String,
                "Action" => <required> [
                    "Market" =>  "ON_DEMAND" or "SPOT",
                    "SimpleScalingPolicyConfiguration" => <required> [
                        "AdjustmentType" =>  "CHANGE_IN_CAPACITY", "PERCENT_CHANGE_IN_CAPACITY" or "EXACT_CAPACITY",
                        "ScalingAdjustment" => <required> ::Int,
                        "CoolDown" =>  ::Int
                    ]
                ],
                "Trigger" => <required> ["CloudWatchAlarmDefinition" => <required> [
                        "ComparisonOperator" => <required> "GREATER_THAN_OR_EQUAL", "GREATER_THAN", "LESS_THAN" or "LESS_THAN_OR_EQUAL",
                        "EvaluationPeriods" =>  ::Int,
                        "MetricName" => <required> ::String,
                        "Namespace" =>  ::String,
                        "Period" => <required> ::Int,
                        "Statistic" =>  "SAMPLE_COUNT", "AVERAGE", "SUM", "MINIMUM" or "MAXIMUM",
                        "Threshold" => <required> double,
                        "Unit" =>  "NONE", "SECONDS", "MICRO_SECONDS", "MILLI_SECONDS", "BYTES", "KILO_BYTES", "MEGA_BYTES", "GIGA_BYTES", "TERA_BYTES", "BITS", "KILO_BITS", "MEGA_BITS", "GIGA_BITS", "TERA_BITS", "PERCENT", "COUNT", "BYTES_PER_SECOND", "KILO_BYTES_PER_SECOND", "MEGA_BYTES_PER_SECOND", "GIGA_BYTES_PER_SECOND", "TERA_BYTES_PER_SECOND", "BITS_PER_SECOND", "KILO_BITS_PER_SECOND", "MEGA_BITS_PER_SECOND", "GIGA_BITS_PER_SECOND", "TERA_BITS_PER_SECOND" or "COUNT_PER_SECOND",
                        "Dimensions" =>  [[
                            "Key" =>  ::String,
                            "Value" =>  ::String
                        ], ...]
                    ]]
            ], ...]
        ]
    ], ...]
```

## `JobFlowId = ::String` -- *Required*
Job flow in which to add the instance groups.

# Returns

`AddInstanceGroupsOutput`

# Exceptions

`InternalServerError`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/AddInstanceGroups)
"""
@inline add_instance_groups(aws::AWSConfig=default_aws_config(); args...) = add_instance_groups(aws, args)

@inline add_instance_groups(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "AddInstanceGroups", args)

@inline add_instance_groups(args) = add_instance_groups(default_aws_config(), args)

"""
    using AWSSDK.EMR.add_job_flow_steps
    add_job_flow_steps([::AWSConfig], arguments::Dict)
    add_job_flow_steps([::AWSConfig]; JobFlowId=, Steps=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "AddJobFlowSteps", arguments::Dict)
    elasticmapreduce([::AWSConfig], "AddJobFlowSteps", JobFlowId=, Steps=)

# AddJobFlowSteps Operation

AddJobFlowSteps adds new steps to a running cluster. A maximum of 256 steps are allowed in each job flow.

If your cluster is long-running (such as a Hive data warehouse) or complex, you may require more than 256 steps to process your data. You can bypass the 256-step limitation in various ways, including using SSH to connect to the master node and submitting queries directly to the software running on the master node, such as Hive and Hadoop. For more information on how to do this, see [Add More than 256 Steps to a Cluster](http://docs.aws.amazon.com/emr/latest/ManagementGuide/AddMoreThan256Steps.html) in the *Amazon EMR Management Guide*.

A step specifies the location of a JAR file stored either on the master node of the cluster or in Amazon S3. Each step is performed by the main function of the main class of the JAR file. The main class can be specified either in the manifest of the JAR or by using the MainFunction parameter of the step.

Amazon EMR executes each step in the order listed. For a step to be considered complete, the main function must exit with a zero exit code and all Hadoop jobs started while the step was running must have completed and run successfully.

You can only add steps to a cluster that is in one of the following states: STARTING, BOOTSTRAPPING, RUNNING, or WAITING.

# Arguments

## `JobFlowId = ::String` -- *Required*
A string that uniquely identifies the job flow. This identifier is returned by [RunJobFlow](@ref) and can also be obtained from [ListClusters](@ref).

## `Steps = [[ ... ], ...]` -- *Required*
A list of [StepConfig](@ref) to be executed by the job flow.
```
 Steps = [[
        "Name" => <required> ::String,
        "ActionOnFailure" =>  "TERMINATE_JOB_FLOW", "TERMINATE_CLUSTER", "CANCEL_AND_WAIT" or "CONTINUE",
        "HadoopJarStep" => <required> [
            "Properties" =>  [[
                "Key" =>  ::String,
                "Value" =>  ::String
            ], ...],
            "Jar" => <required> ::String,
            "MainClass" =>  ::String,
            "Args" =>  [::String, ...]
        ]
    ], ...]
```

# Returns

`AddJobFlowStepsOutput`

# Exceptions

`InternalServerError`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/AddJobFlowSteps)
"""
@inline add_job_flow_steps(aws::AWSConfig=default_aws_config(); args...) = add_job_flow_steps(aws, args)

@inline add_job_flow_steps(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "AddJobFlowSteps", args)

@inline add_job_flow_steps(args) = add_job_flow_steps(default_aws_config(), args)

"""
    using AWSSDK.EMR.add_tags
    add_tags([::AWSConfig], arguments::Dict)
    add_tags([::AWSConfig]; ResourceId=, Tags=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "AddTags", arguments::Dict)
    elasticmapreduce([::AWSConfig], "AddTags", ResourceId=, Tags=)

# AddTags Operation

Adds tags to an Amazon EMR resource. Tags make it easier to associate clusters in various ways, such as grouping clusters to track your Amazon EMR resource allocation costs. For more information, see [Tag Clusters](http://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-plan-tags.html).

# Arguments

## `ResourceId = ::String` -- *Required*
The Amazon EMR resource identifier to which tags will be added. This value must be a cluster identifier.

## `Tags = [[ ... ], ...]` -- *Required*
A list of tags to associate with a cluster and propagate to EC2 instances. Tags are user-defined key/value pairs that consist of a required key string with a maximum of 128 characters, and an optional value string with a maximum of 256 characters.
```
 Tags = [[
        "Key" =>  ::String,
        "Value" =>  ::String
    ], ...]
```

# Returns

`AddTagsOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/AddTags)
"""
@inline add_tags(aws::AWSConfig=default_aws_config(); args...) = add_tags(aws, args)

@inline add_tags(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "AddTags", args)

@inline add_tags(args) = add_tags(default_aws_config(), args)

"""
    using AWSSDK.EMR.cancel_steps
    cancel_steps([::AWSConfig], arguments::Dict)
    cancel_steps([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "CancelSteps", arguments::Dict)
    elasticmapreduce([::AWSConfig], "CancelSteps", <keyword arguments>)

# CancelSteps Operation

Cancels a pending step or steps in a running cluster. Available only in Amazon EMR versions 4.8.0 and later, excluding version 5.0.0. A maximum of 256 steps are allowed in each CancelSteps request. CancelSteps is idempotent but asynchronous; it does not guarantee a step will be canceled, even if the request is successfully submitted. You can only cancel steps that are in a `PENDING` state.

# Arguments

## `ClusterId = ::String`
The `ClusterID` for which specified steps will be canceled. Use [RunJobFlow](@ref) and [ListClusters](@ref) to get ClusterIDs.

## `StepIds = [::String, ...]`
The list of `StepIDs` to cancel. Use [ListSteps](@ref) to get steps and their states for the specified cluster.

# Returns

`CancelStepsOutput`

# Exceptions

`InternalServerError` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/CancelSteps)
"""
@inline cancel_steps(aws::AWSConfig=default_aws_config(); args...) = cancel_steps(aws, args)

@inline cancel_steps(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "CancelSteps", args)

@inline cancel_steps(args) = cancel_steps(default_aws_config(), args)

"""
    using AWSSDK.EMR.create_security_configuration
    create_security_configuration([::AWSConfig], arguments::Dict)
    create_security_configuration([::AWSConfig]; Name=, SecurityConfiguration=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "CreateSecurityConfiguration", arguments::Dict)
    elasticmapreduce([::AWSConfig], "CreateSecurityConfiguration", Name=, SecurityConfiguration=)

# CreateSecurityConfiguration Operation

Creates a security configuration, which is stored in the service and can be specified when a cluster is created.

# Arguments

## `Name = ::String` -- *Required*
The name of the security configuration.

## `SecurityConfiguration = ::String` -- *Required*
The security configuration details in JSON format. For JSON parameters and examples, see [Use Security Configurations to Set Up Cluster Security](http://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-security-configurations.html) in the *Amazon EMR Management Guide*.

# Returns

`CreateSecurityConfigurationOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/CreateSecurityConfiguration)
"""
@inline create_security_configuration(aws::AWSConfig=default_aws_config(); args...) = create_security_configuration(aws, args)

@inline create_security_configuration(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "CreateSecurityConfiguration", args)

@inline create_security_configuration(args) = create_security_configuration(default_aws_config(), args)

"""
    using AWSSDK.EMR.delete_security_configuration
    delete_security_configuration([::AWSConfig], arguments::Dict)
    delete_security_configuration([::AWSConfig]; Name=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "DeleteSecurityConfiguration", arguments::Dict)
    elasticmapreduce([::AWSConfig], "DeleteSecurityConfiguration", Name=)

# DeleteSecurityConfiguration Operation

Deletes a security configuration.

# Arguments

## `Name = ::String` -- *Required*
The name of the security configuration.

# Returns

`DeleteSecurityConfigurationOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/DeleteSecurityConfiguration)
"""
@inline delete_security_configuration(aws::AWSConfig=default_aws_config(); args...) = delete_security_configuration(aws, args)

@inline delete_security_configuration(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "DeleteSecurityConfiguration", args)

@inline delete_security_configuration(args) = delete_security_configuration(default_aws_config(), args)

"""
    using AWSSDK.EMR.describe_cluster
    describe_cluster([::AWSConfig], arguments::Dict)
    describe_cluster([::AWSConfig]; ClusterId=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "DescribeCluster", arguments::Dict)
    elasticmapreduce([::AWSConfig], "DescribeCluster", ClusterId=)

# DescribeCluster Operation

Provides cluster-level details including status, hardware and software configuration, VPC settings, and so on.

# Arguments

## `ClusterId = ::String` -- *Required*
The identifier of the cluster to describe.

# Returns

`DescribeClusterOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/DescribeCluster)
"""
@inline describe_cluster(aws::AWSConfig=default_aws_config(); args...) = describe_cluster(aws, args)

@inline describe_cluster(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "DescribeCluster", args)

@inline describe_cluster(args) = describe_cluster(default_aws_config(), args)

"""
    using AWSSDK.EMR.describe_job_flows
    describe_job_flows([::AWSConfig], arguments::Dict)
    describe_job_flows([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "DescribeJobFlows", arguments::Dict)
    elasticmapreduce([::AWSConfig], "DescribeJobFlows", <keyword arguments>)

# DescribeJobFlows Operation

This API is deprecated and will eventually be removed. We recommend you use [ListClusters](@ref), [DescribeCluster](@ref), [ListSteps](@ref), [ListInstanceGroups](@ref) and [ListBootstrapActions](@ref) instead.

DescribeJobFlows returns a list of job flows that match all of the supplied parameters. The parameters can include a list of job flow IDs, job flow states, and restrictions on job flow creation date and time.

Regardless of supplied parameters, only job flows created within the last two months are returned.

If no parameters are supplied, then job flows matching either of the following criteria are returned:

*   Job flows created and completed in the last two weeks

*   Job flows created within the last two months that are in one of the following states: `RUNNING`, `WAITING`, `SHUTTING_DOWN`, `STARTING`

Amazon EMR can return a maximum of 512 job flow descriptions.

# Arguments

## `CreatedAfter = timestamp`
Return only job flows created after this date and time.

## `CreatedBefore = timestamp`
Return only job flows created before this date and time.

## `JobFlowIds = [::String, ...]`
Return only job flows whose job flow ID is contained in this list.

## `JobFlowStates = ["STARTING", "BOOTSTRAPPING", "RUNNING", "WAITING", "SHUTTING_DOWN", "TERMINATED", "COMPLETED" or "FAILED", ...]`
Return only job flows whose state is contained in this list.

# Returns

`DescribeJobFlowsOutput`

# Exceptions

`InternalServerError`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/DescribeJobFlows)
"""
@inline describe_job_flows(aws::AWSConfig=default_aws_config(); args...) = describe_job_flows(aws, args)

@inline describe_job_flows(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "DescribeJobFlows", args)

@inline describe_job_flows(args) = describe_job_flows(default_aws_config(), args)

"""
    using AWSSDK.EMR.describe_security_configuration
    describe_security_configuration([::AWSConfig], arguments::Dict)
    describe_security_configuration([::AWSConfig]; Name=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "DescribeSecurityConfiguration", arguments::Dict)
    elasticmapreduce([::AWSConfig], "DescribeSecurityConfiguration", Name=)

# DescribeSecurityConfiguration Operation

Provides the details of a security configuration by returning the configuration JSON.

# Arguments

## `Name = ::String` -- *Required*
The name of the security configuration.

# Returns

`DescribeSecurityConfigurationOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/DescribeSecurityConfiguration)
"""
@inline describe_security_configuration(aws::AWSConfig=default_aws_config(); args...) = describe_security_configuration(aws, args)

@inline describe_security_configuration(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "DescribeSecurityConfiguration", args)

@inline describe_security_configuration(args) = describe_security_configuration(default_aws_config(), args)

"""
    using AWSSDK.EMR.describe_step
    describe_step([::AWSConfig], arguments::Dict)
    describe_step([::AWSConfig]; ClusterId=, StepId=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "DescribeStep", arguments::Dict)
    elasticmapreduce([::AWSConfig], "DescribeStep", ClusterId=, StepId=)

# DescribeStep Operation

Provides more detail about the cluster step.

# Arguments

## `ClusterId = ::String` -- *Required*
The identifier of the cluster with steps to describe.

## `StepId = ::String` -- *Required*
The identifier of the step to describe.

# Returns

`DescribeStepOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/DescribeStep)
"""
@inline describe_step(aws::AWSConfig=default_aws_config(); args...) = describe_step(aws, args)

@inline describe_step(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "DescribeStep", args)

@inline describe_step(args) = describe_step(default_aws_config(), args)

"""
    using AWSSDK.EMR.list_bootstrap_actions
    list_bootstrap_actions([::AWSConfig], arguments::Dict)
    list_bootstrap_actions([::AWSConfig]; ClusterId=, <keyword arguments>)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "ListBootstrapActions", arguments::Dict)
    elasticmapreduce([::AWSConfig], "ListBootstrapActions", ClusterId=, <keyword arguments>)

# ListBootstrapActions Operation

Provides information about the bootstrap actions associated with a cluster.

# Arguments

## `ClusterId = ::String` -- *Required*
The cluster identifier for the bootstrap actions to list.

## `Marker = ::String`
The pagination token that indicates the next set of results to retrieve.

# Returns

`ListBootstrapActionsOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListBootstrapActions)
"""
@inline list_bootstrap_actions(aws::AWSConfig=default_aws_config(); args...) = list_bootstrap_actions(aws, args)

@inline list_bootstrap_actions(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "ListBootstrapActions", args)

@inline list_bootstrap_actions(args) = list_bootstrap_actions(default_aws_config(), args)

"""
    using AWSSDK.EMR.list_clusters
    list_clusters([::AWSConfig], arguments::Dict)
    list_clusters([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "ListClusters", arguments::Dict)
    elasticmapreduce([::AWSConfig], "ListClusters", <keyword arguments>)

# ListClusters Operation

Provides the status of all clusters visible to this AWS account. Allows you to filter the list of clusters based on certain criteria; for example, filtering by cluster creation date and time or by status. This call returns a maximum of 50 clusters per call, but returns a marker to track the paging of the cluster list across multiple ListClusters calls.

# Arguments

## `CreatedAfter = timestamp`
The creation date and time beginning value filter for listing clusters.

## `CreatedBefore = timestamp`
The creation date and time end value filter for listing clusters.

## `ClusterStates = ["STARTING", "BOOTSTRAPPING", "RUNNING", "WAITING", "TERMINATING", "TERMINATED" or "TERMINATED_WITH_ERRORS", ...]`
The cluster state filters to apply when listing clusters.

## `Marker = ::String`
The pagination token that indicates the next set of results to retrieve.

# Returns

`ListClustersOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListClusters)
"""
@inline list_clusters(aws::AWSConfig=default_aws_config(); args...) = list_clusters(aws, args)

@inline list_clusters(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "ListClusters", args)

@inline list_clusters(args) = list_clusters(default_aws_config(), args)

"""
    using AWSSDK.EMR.list_instance_fleets
    list_instance_fleets([::AWSConfig], arguments::Dict)
    list_instance_fleets([::AWSConfig]; ClusterId=, <keyword arguments>)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "ListInstanceFleets", arguments::Dict)
    elasticmapreduce([::AWSConfig], "ListInstanceFleets", ClusterId=, <keyword arguments>)

# ListInstanceFleets Operation

Lists all available details about the instance fleets in a cluster.

**Note**
> The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.

# Arguments

## `ClusterId = ::String` -- *Required*
The unique identifier of the cluster.

## `Marker = ::String`
The pagination token that indicates the next set of results to retrieve.

# Returns

`ListInstanceFleetsOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListInstanceFleets)
"""
@inline list_instance_fleets(aws::AWSConfig=default_aws_config(); args...) = list_instance_fleets(aws, args)

@inline list_instance_fleets(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "ListInstanceFleets", args)

@inline list_instance_fleets(args) = list_instance_fleets(default_aws_config(), args)

"""
    using AWSSDK.EMR.list_instance_groups
    list_instance_groups([::AWSConfig], arguments::Dict)
    list_instance_groups([::AWSConfig]; ClusterId=, <keyword arguments>)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "ListInstanceGroups", arguments::Dict)
    elasticmapreduce([::AWSConfig], "ListInstanceGroups", ClusterId=, <keyword arguments>)

# ListInstanceGroups Operation

Provides all available details about the instance groups in a cluster.

# Arguments

## `ClusterId = ::String` -- *Required*
The identifier of the cluster for which to list the instance groups.

## `Marker = ::String`
The pagination token that indicates the next set of results to retrieve.

# Returns

`ListInstanceGroupsOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListInstanceGroups)
"""
@inline list_instance_groups(aws::AWSConfig=default_aws_config(); args...) = list_instance_groups(aws, args)

@inline list_instance_groups(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "ListInstanceGroups", args)

@inline list_instance_groups(args) = list_instance_groups(default_aws_config(), args)

"""
    using AWSSDK.EMR.list_instances
    list_instances([::AWSConfig], arguments::Dict)
    list_instances([::AWSConfig]; ClusterId=, <keyword arguments>)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "ListInstances", arguments::Dict)
    elasticmapreduce([::AWSConfig], "ListInstances", ClusterId=, <keyword arguments>)

# ListInstances Operation

Provides information for all active EC2 instances and EC2 instances terminated in the last 30 days, up to a maximum of 2,000. EC2 instances in any of the following states are considered active: AWAITING_FULFILLMENT, PROVISIONING, BOOTSTRAPPING, RUNNING.

# Arguments

## `ClusterId = ::String` -- *Required*
The identifier of the cluster for which to list the instances.

## `InstanceGroupId = ::String`
The identifier of the instance group for which to list the instances.

## `InstanceGroupTypes = ["MASTER", "CORE" or "TASK", ...]`
The type of instance group for which to list the instances.

## `InstanceFleetId = ::String`
The unique identifier of the instance fleet.

## `InstanceFleetType = "MASTER", "CORE" or "TASK"`
The node type of the instance fleet. For example MASTER, CORE, or TASK.

## `InstanceStates = ["AWAITING_FULFILLMENT", "PROVISIONING", "BOOTSTRAPPING", "RUNNING" or "TERMINATED", ...]`
A list of instance states that will filter the instances returned with this request.

## `Marker = ::String`
The pagination token that indicates the next set of results to retrieve.

# Returns

`ListInstancesOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListInstances)
"""
@inline list_instances(aws::AWSConfig=default_aws_config(); args...) = list_instances(aws, args)

@inline list_instances(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "ListInstances", args)

@inline list_instances(args) = list_instances(default_aws_config(), args)

"""
    using AWSSDK.EMR.list_security_configurations
    list_security_configurations([::AWSConfig], arguments::Dict)
    list_security_configurations([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "ListSecurityConfigurations", arguments::Dict)
    elasticmapreduce([::AWSConfig], "ListSecurityConfigurations", <keyword arguments>)

# ListSecurityConfigurations Operation

Lists all the security configurations visible to this account, providing their creation dates and times, and their names. This call returns a maximum of 50 clusters per call, but returns a marker to track the paging of the cluster list across multiple ListSecurityConfigurations calls.

# Arguments

## `Marker = ::String`
The pagination token that indicates the set of results to retrieve.

# Returns

`ListSecurityConfigurationsOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListSecurityConfigurations)
"""
@inline list_security_configurations(aws::AWSConfig=default_aws_config(); args...) = list_security_configurations(aws, args)

@inline list_security_configurations(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "ListSecurityConfigurations", args)

@inline list_security_configurations(args) = list_security_configurations(default_aws_config(), args)

"""
    using AWSSDK.EMR.list_steps
    list_steps([::AWSConfig], arguments::Dict)
    list_steps([::AWSConfig]; ClusterId=, <keyword arguments>)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "ListSteps", arguments::Dict)
    elasticmapreduce([::AWSConfig], "ListSteps", ClusterId=, <keyword arguments>)

# ListSteps Operation

Provides a list of steps for the cluster in reverse order unless you specify stepIds with the request.

# Arguments

## `ClusterId = ::String` -- *Required*
The identifier of the cluster for which to list the steps.

## `StepStates = ["PENDING", "CANCEL_PENDING", "RUNNING", "COMPLETED", "CANCELLED", "FAILED" or "INTERRUPTED", ...]`
The filter to limit the step list based on certain states.

## `StepIds = [::String, ...]`
The filter to limit the step list based on the identifier of the steps.

## `Marker = ::String`
The pagination token that indicates the next set of results to retrieve.

# Returns

`ListStepsOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ListSteps)
"""
@inline list_steps(aws::AWSConfig=default_aws_config(); args...) = list_steps(aws, args)

@inline list_steps(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "ListSteps", args)

@inline list_steps(args) = list_steps(default_aws_config(), args)

"""
    using AWSSDK.EMR.modify_instance_fleet
    modify_instance_fleet([::AWSConfig], arguments::Dict)
    modify_instance_fleet([::AWSConfig]; ClusterId=, InstanceFleet=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "ModifyInstanceFleet", arguments::Dict)
    elasticmapreduce([::AWSConfig], "ModifyInstanceFleet", ClusterId=, InstanceFleet=)

# ModifyInstanceFleet Operation

Modifies the target On-Demand and target Spot capacities for the instance fleet with the specified InstanceFleetID within the cluster specified using ClusterID. The call either succeeds or fails atomically.

**Note**
> The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.

# Arguments

## `ClusterId = ::String` -- *Required*
The unique identifier of the cluster.

## `InstanceFleet = [ ... ]` -- *Required*
The unique identifier of the instance fleet.
```
 InstanceFleet = [
        "InstanceFleetId" => <required> ::String,
        "TargetOnDemandCapacity" =>  ::Int,
        "TargetSpotCapacity" =>  ::Int
    ]
```

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ModifyInstanceFleet)
"""
@inline modify_instance_fleet(aws::AWSConfig=default_aws_config(); args...) = modify_instance_fleet(aws, args)

@inline modify_instance_fleet(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "ModifyInstanceFleet", args)

@inline modify_instance_fleet(args) = modify_instance_fleet(default_aws_config(), args)

"""
    using AWSSDK.EMR.modify_instance_groups
    modify_instance_groups([::AWSConfig], arguments::Dict)
    modify_instance_groups([::AWSConfig]; <keyword arguments>)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "ModifyInstanceGroups", arguments::Dict)
    elasticmapreduce([::AWSConfig], "ModifyInstanceGroups", <keyword arguments>)

# ModifyInstanceGroups Operation

ModifyInstanceGroups modifies the number of nodes and configuration settings of an instance group. The input parameters include the new target instance count for the group and the instance group ID. The call will either succeed or fail atomically.

# Arguments

## `ClusterId = ::String`
The ID of the cluster to which the instance group belongs.

## `InstanceGroups = [[ ... ], ...]`
Instance groups to change.
```
 InstanceGroups = [[
        "InstanceGroupId" => <required> ::String,
        "InstanceCount" =>  ::Int,
        "EC2InstanceIdsToTerminate" =>  [::String, ...],
        "ShrinkPolicy" =>  [
            "DecommissionTimeout" =>  ::Int,
            "InstanceResizePolicy" =>  [
                "InstancesToTerminate" =>  [::String, ...],
                "InstancesToProtect" =>  [::String, ...],
                "InstanceTerminationTimeout" =>  ::Int
            ]
        ]
    ], ...]
```

# Exceptions

`InternalServerError`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/ModifyInstanceGroups)
"""
@inline modify_instance_groups(aws::AWSConfig=default_aws_config(); args...) = modify_instance_groups(aws, args)

@inline modify_instance_groups(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "ModifyInstanceGroups", args)

@inline modify_instance_groups(args) = modify_instance_groups(default_aws_config(), args)

"""
    using AWSSDK.EMR.put_auto_scaling_policy
    put_auto_scaling_policy([::AWSConfig], arguments::Dict)
    put_auto_scaling_policy([::AWSConfig]; ClusterId=, InstanceGroupId=, AutoScalingPolicy=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "PutAutoScalingPolicy", arguments::Dict)
    elasticmapreduce([::AWSConfig], "PutAutoScalingPolicy", ClusterId=, InstanceGroupId=, AutoScalingPolicy=)

# PutAutoScalingPolicy Operation

Creates or updates an automatic scaling policy for a core instance group or task instance group in an Amazon EMR cluster. The automatic scaling policy defines how an instance group dynamically adds and terminates EC2 instances in response to the value of a CloudWatch metric.

# Arguments

## `ClusterId = ::String` -- *Required*
Specifies the ID of a cluster. The instance group to which the automatic scaling policy is applied is within this cluster.

## `InstanceGroupId = ::String` -- *Required*
Specifies the ID of the instance group to which the automatic scaling policy is applied.

## `AutoScalingPolicy = [ ... ]` -- *Required*
Specifies the definition of the automatic scaling policy.
```
 AutoScalingPolicy = [
        "Constraints" => <required> [
            "MinCapacity" => <required> ::Int,
            "MaxCapacity" => <required> ::Int
        ],
        "Rules" => <required> [[
            "Name" => <required> ::String,
            "Description" =>  ::String,
            "Action" => <required> [
                "Market" =>  "ON_DEMAND" or "SPOT",
                "SimpleScalingPolicyConfiguration" => <required> [
                    "AdjustmentType" =>  "CHANGE_IN_CAPACITY", "PERCENT_CHANGE_IN_CAPACITY" or "EXACT_CAPACITY",
                    "ScalingAdjustment" => <required> ::Int,
                    "CoolDown" =>  ::Int
                ]
            ],
            "Trigger" => <required> ["CloudWatchAlarmDefinition" => <required> [
                    "ComparisonOperator" => <required> "GREATER_THAN_OR_EQUAL", "GREATER_THAN", "LESS_THAN" or "LESS_THAN_OR_EQUAL",
                    "EvaluationPeriods" =>  ::Int,
                    "MetricName" => <required> ::String,
                    "Namespace" =>  ::String,
                    "Period" => <required> ::Int,
                    "Statistic" =>  "SAMPLE_COUNT", "AVERAGE", "SUM", "MINIMUM" or "MAXIMUM",
                    "Threshold" => <required> double,
                    "Unit" =>  "NONE", "SECONDS", "MICRO_SECONDS", "MILLI_SECONDS", "BYTES", "KILO_BYTES", "MEGA_BYTES", "GIGA_BYTES", "TERA_BYTES", "BITS", "KILO_BITS", "MEGA_BITS", "GIGA_BITS", "TERA_BITS", "PERCENT", "COUNT", "BYTES_PER_SECOND", "KILO_BYTES_PER_SECOND", "MEGA_BYTES_PER_SECOND", "GIGA_BYTES_PER_SECOND", "TERA_BYTES_PER_SECOND", "BITS_PER_SECOND", "KILO_BITS_PER_SECOND", "MEGA_BITS_PER_SECOND", "GIGA_BITS_PER_SECOND", "TERA_BITS_PER_SECOND" or "COUNT_PER_SECOND",
                    "Dimensions" =>  [[
                        "Key" =>  ::String,
                        "Value" =>  ::String
                    ], ...]
                ]]
        ], ...]
    ]
```

# Returns

`PutAutoScalingPolicyOutput`

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/PutAutoScalingPolicy)
"""
@inline put_auto_scaling_policy(aws::AWSConfig=default_aws_config(); args...) = put_auto_scaling_policy(aws, args)

@inline put_auto_scaling_policy(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "PutAutoScalingPolicy", args)

@inline put_auto_scaling_policy(args) = put_auto_scaling_policy(default_aws_config(), args)

"""
    using AWSSDK.EMR.remove_auto_scaling_policy
    remove_auto_scaling_policy([::AWSConfig], arguments::Dict)
    remove_auto_scaling_policy([::AWSConfig]; ClusterId=, InstanceGroupId=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "RemoveAutoScalingPolicy", arguments::Dict)
    elasticmapreduce([::AWSConfig], "RemoveAutoScalingPolicy", ClusterId=, InstanceGroupId=)

# RemoveAutoScalingPolicy Operation

Removes an automatic scaling policy from a specified instance group within an EMR cluster.

# Arguments

## `ClusterId = ::String` -- *Required*
Specifies the ID of a cluster. The instance group to which the automatic scaling policy is applied is within this cluster.

## `InstanceGroupId = ::String` -- *Required*
Specifies the ID of the instance group to which the scaling policy is applied.

# Returns

`RemoveAutoScalingPolicyOutput`

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/RemoveAutoScalingPolicy)
"""
@inline remove_auto_scaling_policy(aws::AWSConfig=default_aws_config(); args...) = remove_auto_scaling_policy(aws, args)

@inline remove_auto_scaling_policy(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "RemoveAutoScalingPolicy", args)

@inline remove_auto_scaling_policy(args) = remove_auto_scaling_policy(default_aws_config(), args)

"""
    using AWSSDK.EMR.remove_tags
    remove_tags([::AWSConfig], arguments::Dict)
    remove_tags([::AWSConfig]; ResourceId=, TagKeys=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "RemoveTags", arguments::Dict)
    elasticmapreduce([::AWSConfig], "RemoveTags", ResourceId=, TagKeys=)

# RemoveTags Operation

Removes tags from an Amazon EMR resource. Tags make it easier to associate clusters in various ways, such as grouping clusters to track your Amazon EMR resource allocation costs. For more information, see [Tag Clusters](http://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-plan-tags.html).

The following example removes the stack tag with value Prod from a cluster:

# Arguments

## `ResourceId = ::String` -- *Required*
The Amazon EMR resource identifier from which tags will be removed. This value must be a cluster identifier.

## `TagKeys = [::String, ...]` -- *Required*
A list of tag keys to remove from a resource.

# Returns

`RemoveTagsOutput`

# Exceptions

`InternalServerException` or `InvalidRequestException`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/RemoveTags)
"""
@inline remove_tags(aws::AWSConfig=default_aws_config(); args...) = remove_tags(aws, args)

@inline remove_tags(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "RemoveTags", args)

@inline remove_tags(args) = remove_tags(default_aws_config(), args)

"""
    using AWSSDK.EMR.run_job_flow
    run_job_flow([::AWSConfig], arguments::Dict)
    run_job_flow([::AWSConfig]; Name=, Instances=, <keyword arguments>)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "RunJobFlow", arguments::Dict)
    elasticmapreduce([::AWSConfig], "RunJobFlow", Name=, Instances=, <keyword arguments>)

# RunJobFlow Operation

RunJobFlow creates and starts running a new cluster (job flow). The cluster runs the steps specified. After the steps complete, the cluster stops and the HDFS partition is lost. To prevent loss of data, configure the last step of the job flow to store results in Amazon S3. If the [JobFlowInstancesConfig](@ref) `KeepJobFlowAliveWhenNoSteps` parameter is set to `TRUE`, the cluster transitions to the WAITING state rather than shutting down after the steps have completed.

For additional protection, you can set the [JobFlowInstancesConfig](@ref) `TerminationProtected` parameter to `TRUE` to lock the cluster and prevent it from being terminated by API call, user intervention, or in the event of a job flow error.

A maximum of 256 steps are allowed in each job flow.

If your cluster is long-running (such as a Hive data warehouse) or complex, you may require more than 256 steps to process your data. You can bypass the 256-step limitation in various ways, including using the SSH shell to connect to the master node and submitting queries directly to the software running on the master node, such as Hive and Hadoop. For more information on how to do this, see [Add More than 256 Steps to a Cluster](http://docs.aws.amazon.com/emr/latest/ManagementGuide/AddMoreThan256Steps.html) in the *Amazon EMR Management Guide*.

For long running clusters, we recommend that you periodically store your results.

**Note**
> The instance fleets configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions. The RunJobFlow request can contain InstanceFleets parameters or InstanceGroups parameters, but not both.

# Arguments

## `Name = ::String` -- *Required*
The name of the job flow.

## `LogUri = ::String`
The location in Amazon S3 to write the log files of the job flow. If a value is not provided, logs are not created.

## `AdditionalInfo = ::String`
A JSON string for selecting additional features.

## `AmiVersion = ::String`
Applies only to Amazon EMR AMI versions 3.x and 2.x. For Amazon EMR releases 4.0 and later, `ReleaseLabel` is used. To specify a custom AMI, use `CustomAmiID`.

## `ReleaseLabel = ::String`
The Amazon EMR release label, which determines the version of open-source application packages installed on the cluster. Release labels are in the form `emr-x.x.x`, where x.x.x is an Amazon EMR release version, for example, `emr-5.14.0`. For more information about Amazon EMR release versions and included application versions and features, see [http://docs.aws.amazon.com/emr/latest/ReleaseGuide/](http://docs.aws.amazon.com/emr/latest/ReleaseGuide/). The release label applies only to Amazon EMR releases versions 4.x and later. Earlier versions use `AmiVersion`.

## `Instances = [ ... ]` -- *Required*
A specification of the number and type of Amazon EC2 instances.
```
 Instances = [
        "MasterInstanceType" =>  ::String,
        "SlaveInstanceType" =>  ::String,
        "InstanceCount" =>  ::Int,
        "InstanceGroups" =>  [[
            "Name" =>  ::String,
            "Market" =>  "ON_DEMAND" or "SPOT",
            "InstanceRole" => <required> "MASTER", "CORE" or "TASK",
            "BidPrice" =>  ::String,
            "InstanceType" => <required> ::String,
            "InstanceCount" => <required> ::Int,
            "Configurations" =>  [[
                "Classification" =>  ::String,
                "Configurations" =>  list,
                "Properties" =>  ::Dict{String,String}
            ], ...],
            "EbsConfiguration" =>  [
                "EbsBlockDeviceConfigs" =>  [[
                    "VolumeSpecification" => <required> [
                        "VolumeType" => <required> ::String,
                        "Iops" =>  ::Int,
                        "SizeInGB" => <required> ::Int
                    ],
                    "VolumesPerInstance" =>  ::Int
                ], ...],
                "EbsOptimized" =>  ::Bool
            ],
            "AutoScalingPolicy" =>  [
                "Constraints" => <required> [
                    "MinCapacity" => <required> ::Int,
                    "MaxCapacity" => <required> ::Int
                ],
                "Rules" => <required> [[
                    "Name" => <required> ::String,
                    "Description" =>  ::String,
                    "Action" => <required> [
                        "Market" =>  "ON_DEMAND" or "SPOT",
                        "SimpleScalingPolicyConfiguration" => <required> [
                            "AdjustmentType" =>  "CHANGE_IN_CAPACITY", "PERCENT_CHANGE_IN_CAPACITY" or "EXACT_CAPACITY",
                            "ScalingAdjustment" => <required> ::Int,
                            "CoolDown" =>  ::Int
                        ]
                    ],
                    "Trigger" => <required> ["CloudWatchAlarmDefinition" => <required> [
                            "ComparisonOperator" => <required> "GREATER_THAN_OR_EQUAL", "GREATER_THAN", "LESS_THAN" or "LESS_THAN_OR_EQUAL",
                            "EvaluationPeriods" =>  ::Int,
                            "MetricName" => <required> ::String,
                            "Namespace" =>  ::String,
                            "Period" => <required> ::Int,
                            "Statistic" =>  "SAMPLE_COUNT", "AVERAGE", "SUM", "MINIMUM" or "MAXIMUM",
                            "Threshold" => <required> double,
                            "Unit" =>  "NONE", "SECONDS", "MICRO_SECONDS", "MILLI_SECONDS", "BYTES", "KILO_BYTES", "MEGA_BYTES", "GIGA_BYTES", "TERA_BYTES", "BITS", "KILO_BITS", "MEGA_BITS", "GIGA_BITS", "TERA_BITS", "PERCENT", "COUNT", "BYTES_PER_SECOND", "KILO_BYTES_PER_SECOND", "MEGA_BYTES_PER_SECOND", "GIGA_BYTES_PER_SECOND", "TERA_BYTES_PER_SECOND", "BITS_PER_SECOND", "KILO_BITS_PER_SECOND", "MEGA_BITS_PER_SECOND", "GIGA_BITS_PER_SECOND", "TERA_BITS_PER_SECOND" or "COUNT_PER_SECOND",
                            "Dimensions" =>  [[
                                "Key" =>  ::String,
                                "Value" =>  ::String
                            ], ...]
                        ]]
                ], ...]
            ]
        ], ...],
        "InstanceFleets" =>  [[
            "Name" =>  ::String,
            "InstanceFleetType" => <required> "MASTER", "CORE" or "TASK",
            "TargetOnDemandCapacity" =>  ::Int,
            "TargetSpotCapacity" =>  ::Int,
            "InstanceTypeConfigs" =>  [[
                "InstanceType" => <required> ::String,
                "WeightedCapacity" =>  ::Int,
                "BidPrice" =>  ::String,
                "BidPriceAsPercentageOfOnDemandPrice" =>  double,
                "EbsConfiguration" =>  [
                    "EbsBlockDeviceConfigs" =>  [[
                        "VolumeSpecification" => <required> [
                            "VolumeType" => <required> ::String,
                            "Iops" =>  ::Int,
                            "SizeInGB" => <required> ::Int
                        ],
                        "VolumesPerInstance" =>  ::Int
                    ], ...],
                    "EbsOptimized" =>  ::Bool
                ],
                "Configurations" =>  [[
                    "Classification" =>  ::String,
                    "Configurations" =>  list,
                    "Properties" =>  ::Dict{String,String}
                ], ...]
            ], ...],
            "LaunchSpecifications" =>  ["SpotSpecification" => <required> [
                    "TimeoutDurationMinutes" => <required> ::Int,
                    "TimeoutAction" => <required> "SWITCH_TO_ON_DEMAND" or "TERMINATE_CLUSTER",
                    "BlockDurationMinutes" =>  ::Int
                ]]
        ], ...],
        "Ec2KeyName" =>  ::String,
        "Placement" =>  [
            "AvailabilityZone" =>  ::String,
            "AvailabilityZones" =>  [::String, ...]
        ],
        "KeepJobFlowAliveWhenNoSteps" =>  ::Bool,
        "TerminationProtected" =>  ::Bool,
        "HadoopVersion" =>  ::String,
        "Ec2SubnetId" =>  ::String,
        "Ec2SubnetIds" =>  [::String, ...],
        "EmrManagedMasterSecurityGroup" =>  ::String,
        "EmrManagedSlaveSecurityGroup" =>  ::String,
        "ServiceAccessSecurityGroup" =>  ::String,
        "AdditionalMasterSecurityGroups" =>  [::String, ...],
        "AdditionalSlaveSecurityGroups" =>  [::String, ...]
    ]
```

## `Steps = [[ ... ], ...]`
A list of steps to run.
```
 Steps = [[
        "Name" => <required> ::String,
        "ActionOnFailure" =>  "TERMINATE_JOB_FLOW", "TERMINATE_CLUSTER", "CANCEL_AND_WAIT" or "CONTINUE",
        "HadoopJarStep" => <required> [
            "Properties" =>  [[
                "Key" =>  ::String,
                "Value" =>  ::String
            ], ...],
            "Jar" => <required> ::String,
            "MainClass" =>  ::String,
            "Args" =>  [::String, ...]
        ]
    ], ...]
```

## `BootstrapActions = [[ ... ], ...]`
A list of bootstrap actions to run before Hadoop starts on the cluster nodes.
```
 BootstrapActions = [[
        "Name" => <required> ::String,
        "ScriptBootstrapAction" => <required> [
            "Path" => <required> ::String,
            "Args" =>  [::String, ...]
        ]
    ], ...]
```

## `SupportedProducts = [::String, ...]`

**Note**
> For Amazon EMR releases 3.x and 2.x. For Amazon EMR releases 4.x and later, use Applications.

A list of strings that indicates third-party software to use. For more information, see the [Amazon EMR Developer Guide](http://docs.aws.amazon.com/emr/latest/DeveloperGuide/emr-dg.pdf). Currently supported values are:

*   "mapr-m3" - launch the job flow using MapR M3 Edition.

*   "mapr-m5" - launch the job flow using MapR M5 Edition.

## `NewSupportedProducts = [[ ... ], ...]`

**Note**
> For Amazon EMR releases 3.x and 2.x. For Amazon EMR releases 4.x and later, use Applications.

A list of strings that indicates third-party software to use with the job flow that accepts a user argument list. EMR accepts and forwards the argument list to the corresponding installation script as bootstrap action arguments. For more information, see "Launch a Job Flow on the MapR Distribution for Hadoop" in the [Amazon EMR Developer Guide](http://docs.aws.amazon.com/emr/latest/DeveloperGuide/emr-dg.pdf). Supported values are:

*   "mapr-m3" - launch the cluster using MapR M3 Edition.

*   "mapr-m5" - launch the cluster using MapR M5 Edition.

*   "mapr" with the user arguments specifying "--edition,m3" or "--edition,m5" - launch the job flow using MapR M3 or M5 Edition respectively.

*   "mapr-m7" - launch the cluster using MapR M7 Edition.

*   "hunk" - launch the cluster with the Hunk Big Data Analtics Platform.

*   "hue"- launch the cluster with Hue installed.

*   "spark" - launch the cluster with Apache Spark installed.

*   "ganglia" - launch the cluster with the Ganglia Monitoring System installed.
```
 NewSupportedProducts = [[
        "Name" =>  ::String,
        "Args" =>  [::String, ...]
    ], ...]
```

## `Applications = [[ ... ], ...]`
For Amazon EMR releases 4.0 and later. A list of applications for the cluster. Valid values are: "Hadoop", "Hive", "Mahout", "Pig", and "Spark." They are case insensitive.
```
 Applications = [[
        "Name" =>  ::String,
        "Version" =>  ::String,
        "Args" =>  [::String, ...],
        "AdditionalInfo" =>  ::Dict{String,String}
    ], ...]
```

## `Configurations = [[ ... ], ...]`
For Amazon EMR releases 4.0 and later. The list of configurations supplied for the EMR cluster you are creating.
```
 Configurations = [[
        "Classification" =>  ::String,
        "Configurations" =>  list,
        "Properties" =>  ::Dict{String,String}
    ], ...]
```

## `VisibleToAllUsers = ::Bool`
Whether the cluster is visible to all IAM users of the AWS account associated with the cluster. If this value is set to `true`, all IAM users of that AWS account can view and (if they have the proper policy permissions set) manage the cluster. If it is set to `false`, only the IAM user that created the cluster can view and manage it.

## `JobFlowRole = ::String`
Also called instance profile and EC2 role. An IAM role for an EMR cluster. The EC2 instances of the cluster assume this role. The default role is `EMR_EC2_DefaultRole`. In order to use the default role, you must have already created it using the CLI or console.

## `ServiceRole = ::String`
The IAM role that will be assumed by the Amazon EMR service to access AWS resources on your behalf.

## `Tags = [[ ... ], ...]`
A list of tags to associate with a cluster and propagate to Amazon EC2 instances.
```
 Tags = [[
        "Key" =>  ::String,
        "Value" =>  ::String
    ], ...]
```

## `SecurityConfiguration = ::String`
The name of a security configuration to apply to the cluster.

## `AutoScalingRole = ::String`
An IAM role for automatic scaling policies. The default role is `EMR_AutoScaling_DefaultRole`. The IAM role provides permissions that the automatic scaling feature requires to launch and terminate EC2 instances in an instance group.

## `ScaleDownBehavior = "TERMINATE_AT_INSTANCE_HOUR" or "TERMINATE_AT_TASK_COMPLETION"`
Specifies the way that individual Amazon EC2 instances terminate when an automatic scale-in activity occurs or an instance group is resized. `TERMINATE_AT_INSTANCE_HOUR` indicates that Amazon EMR terminates nodes at the instance-hour boundary, regardless of when the request to terminate the instance was submitted. This option is only available with Amazon EMR 5.1.0 and later and is the default for clusters created using that version. `TERMINATE_AT_TASK_COMPLETION` indicates that Amazon EMR blacklists and drains tasks from nodes before terminating the Amazon EC2 instances, regardless of the instance-hour boundary. With either behavior, Amazon EMR removes the least active nodes first and blocks instance termination if it could lead to HDFS corruption. `TERMINATE_AT_TASK_COMPLETION` available only in Amazon EMR version 4.1.0 and later, and is the default for versions of Amazon EMR earlier than 5.1.0.

## `CustomAmiId = ::String`
Available only in Amazon EMR version 5.7.0 and later. The ID of a custom Amazon EBS-backed Linux AMI. If specified, Amazon EMR uses this AMI when it launches cluster EC2 instances. For more information about custom AMIs in Amazon EMR, see [Using a Custom AMI](http://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-custom-ami.html) in the *Amazon EMR Management Guide*. If omitted, the cluster uses the base Linux AMI for the `ReleaseLabel` specified. For Amazon EMR versions 2.x and 3.x, use `AmiVersion` instead.

For information about creating a custom AMI, see [Creating an Amazon EBS-Backed Linux AMI](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami-ebs.html) in the *Amazon Elastic Compute Cloud User Guide for Linux Instances*. For information about finding an AMI ID, see [Finding a Linux AMI](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html).

## `EbsRootVolumeSize = ::Int`
The size, in GiB, of the EBS root device volume of the Linux AMI that is used for each EC2 instance. Available in Amazon EMR version 4.x and later.

## `RepoUpgradeOnBoot = "SECURITY" or "NONE"`
Applies only when `CustomAmiID` is used. Specifies which updates from the Amazon Linux AMI package repositories to apply automatically when the instance boots using the AMI. If omitted, the default is `SECURITY`, which indicates that only security updates are applied. If `NONE` is specified, no updates are applied, and all updates must be applied manually.

## `KerberosAttributes = [ ... ]`
Attributes for Kerberos configuration when Kerberos authentication is enabled using a security configuration. For more information see [Use Kerberos Authentication](http://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-kerberos.html) in the *EMR Management Guide*.
```
 KerberosAttributes = [
        "Realm" => <required> ::String,
        "KdcAdminPassword" => <required> ::String,
        "CrossRealmTrustPrincipalPassword" =>  ::String,
        "ADDomainJoinUser" =>  ::String,
        "ADDomainJoinPassword" =>  ::String
    ]
```

# Returns

`RunJobFlowOutput`

# Exceptions

`InternalServerError`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/RunJobFlow)
"""
@inline run_job_flow(aws::AWSConfig=default_aws_config(); args...) = run_job_flow(aws, args)

@inline run_job_flow(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "RunJobFlow", args)

@inline run_job_flow(args) = run_job_flow(default_aws_config(), args)

"""
    using AWSSDK.EMR.set_termination_protection
    set_termination_protection([::AWSConfig], arguments::Dict)
    set_termination_protection([::AWSConfig]; JobFlowIds=, TerminationProtected=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "SetTerminationProtection", arguments::Dict)
    elasticmapreduce([::AWSConfig], "SetTerminationProtection", JobFlowIds=, TerminationProtected=)

# SetTerminationProtection Operation

SetTerminationProtection locks a cluster (job flow) so the EC2 instances in the cluster cannot be terminated by user intervention, an API call, or in the event of a job-flow error. The cluster still terminates upon successful completion of the job flow. Calling `SetTerminationProtection` on a cluster is similar to calling the Amazon EC2 `DisableAPITermination` API on all EC2 instances in a cluster.

`SetTerminationProtection` is used to prevent accidental termination of a cluster and to ensure that in the event of an error, the instances persist so that you can recover any data stored in their ephemeral instance storage.

To terminate a cluster that has been locked by setting `SetTerminationProtection` to `true`, you must first unlock the job flow by a subsequent call to `SetTerminationProtection` in which you set the value to `false`.

For more information, see[Managing Cluster Termination](http://docs.aws.amazon.com/emr/latest/ManagementGuide/UsingEMR_TerminationProtection.html) in the *Amazon EMR Management Guide*.

# Arguments

## `JobFlowIds = [::String, ...]` -- *Required*
A list of strings that uniquely identify the clusters to protect. This identifier is returned by [RunJobFlow](@ref) and can also be obtained from [DescribeJobFlows](@ref) .

## `TerminationProtected = ::Bool` -- *Required*
A Boolean that indicates whether to protect the cluster and prevent the Amazon EC2 instances in the cluster from shutting down due to API calls, user intervention, or job-flow error.

# Exceptions

`InternalServerError`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/SetTerminationProtection)
"""
@inline set_termination_protection(aws::AWSConfig=default_aws_config(); args...) = set_termination_protection(aws, args)

@inline set_termination_protection(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "SetTerminationProtection", args)

@inline set_termination_protection(args) = set_termination_protection(default_aws_config(), args)

"""
    using AWSSDK.EMR.set_visible_to_all_users
    set_visible_to_all_users([::AWSConfig], arguments::Dict)
    set_visible_to_all_users([::AWSConfig]; JobFlowIds=, VisibleToAllUsers=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "SetVisibleToAllUsers", arguments::Dict)
    elasticmapreduce([::AWSConfig], "SetVisibleToAllUsers", JobFlowIds=, VisibleToAllUsers=)

# SetVisibleToAllUsers Operation

Sets whether all AWS Identity and Access Management (IAM) users under your account can access the specified clusters (job flows). This action works on running clusters. You can also set the visibility of a cluster when you launch it using the `VisibleToAllUsers` parameter of [RunJobFlow](@ref). The SetVisibleToAllUsers action can be called only by an IAM user who created the cluster or the AWS account that owns the cluster.

# Arguments

## `JobFlowIds = [::String, ...]` -- *Required*
Identifiers of the job flows to receive the new visibility setting.

## `VisibleToAllUsers = ::Bool` -- *Required*
Whether the specified clusters are visible to all IAM users of the AWS account associated with the cluster. If this value is set to True, all IAM users of that AWS account can view and, if they have the proper IAM policy permissions set, manage the clusters. If it is set to False, only the IAM user that created a cluster can view and manage it.

# Exceptions

`InternalServerError`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/SetVisibleToAllUsers)
"""
@inline set_visible_to_all_users(aws::AWSConfig=default_aws_config(); args...) = set_visible_to_all_users(aws, args)

@inline set_visible_to_all_users(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "SetVisibleToAllUsers", args)

@inline set_visible_to_all_users(args) = set_visible_to_all_users(default_aws_config(), args)

"""
    using AWSSDK.EMR.terminate_job_flows
    terminate_job_flows([::AWSConfig], arguments::Dict)
    terminate_job_flows([::AWSConfig]; JobFlowIds=)

    using AWSCore.Services.elasticmapreduce
    elasticmapreduce([::AWSConfig], "TerminateJobFlows", arguments::Dict)
    elasticmapreduce([::AWSConfig], "TerminateJobFlows", JobFlowIds=)

# TerminateJobFlows Operation

TerminateJobFlows shuts a list of clusters (job flows) down. When a job flow is shut down, any step not yet completed is canceled and the EC2 instances on which the cluster is running are stopped. Any log files not already saved are uploaded to Amazon S3 if a LogUri was specified when the cluster was created.

The maximum number of clusters allowed is 10. The call to `TerminateJobFlows` is asynchronous. Depending on the configuration of the cluster, it may take up to 1-5 minutes for the cluster to completely terminate and release allocated resources, such as Amazon EC2 instances.

# Arguments

## `JobFlowIds = [::String, ...]` -- *Required*
A list of job flows to be shutdown.

# Exceptions

`InternalServerError`.

See also: [AWS API Documentation](https://docs.aws.amazon.com/goto/WebAPI/elasticmapreduce-2009-03-31/TerminateJobFlows)
"""
@inline terminate_job_flows(aws::AWSConfig=default_aws_config(); args...) = terminate_job_flows(aws, args)

@inline terminate_job_flows(aws::AWSConfig, args) = AWSCore.Services.elasticmapreduce(aws, "TerminateJobFlows", args)

@inline terminate_job_flows(args) = terminate_job_flows(default_aws_config(), args)

end # module EMR

#==============================================================================#
# End of file
#==============================================================================#


text:
#N = 8000
N = 500

srand(1)

A = complex(sprand(N, N, 0.1))

v1 = rand(Complex128, N, N)
result = rand(Complex128, N, N)

function mm1(alpha::Complex128, M::SparseMatrixCSC{Complex128}, v::Matrix{Complex128}, beta::Complex128, result::Matrix{Complex128})
    @inbounds for j=1:size(result,2), i=1:size(result,1)
        result[i,j] *= beta
    end
    @inbounds for colindex = 1:M.n::Int
        for i=M.colptr[colindex]:M.colptr[colindex+1]-1
            for j=1:size(result,2)
                result[M.rowval[i], j] += M.nzval[i]*alpha*v[colindex, j]
            end
        end
    end
    nothing
end

function mm2(alpha::Complex128, M::SparseMatrixCSC{Complex128}, M2::Matrix{Complex128}, beta::Complex128, result::Matrix{Complex128})
    @inbounds for j=1:size(result,2), i=1:size(result,1)
        result[i,j] *= beta
    end
    @inbounds for j=1:M.m
        for colindex = 1:M.n
            m2 = alpha*M2[colindex, j]
            for i=M.colptr[colindex]:M.colptr[colindex+1]-1
                result[M.rowval[i], j] += M.nzval[i]*m2
            end
        end
    end
    nothing
end

function mm1(alpha::Complex128, v::Matrix{Complex128}, M::SparseMatrixCSC{Complex128}, beta::Complex128, result::Matrix{Complex128})
    @inbounds for j=1:size(result,2), i=1:size(result,1)
        result[i,j] *= beta
    end
    @inbounds for colindex = 1:M.n
        for i=M.colptr[colindex]:M.colptr[colindex+1]-1
            mi = M.nzval[i]*alpha
            mrowvali = M.rowval[i]
            for j=1:size(result,1)
                result[j,colindex] += mi*v[j,mrowvali]
            end
        end
    end
    nothing
end

function mm2(alpha::Complex128, v::Matrix{Complex128}, M::SparseMatrixCSC{Complex128}, beta::Complex128, result::Matrix{Complex128})
    @inbounds for j=1:size(result,2), i=1:size(result,1)
        result[i,j] *= beta
    end
    @inbounds for j=1:size(result,1)
        for colindex = 1:M.n
            for i=M.colptr[colindex]:M.colptr[colindex+1]-1
                result[j,colindex] += M.nzval[i]*alpha*v[j,M.rowval[i]]
            end
        end
    end
    nothing
end

@time mm1(Complex(1.), A, v1, Complex(0.), result)
@time mm1(Complex(1.), A, v1, Complex(0.), result)

println(norm(result-A*v1))

@time mm2(Complex(1.), A, v1, Complex(0.), result)
@time mm2(Complex(1.), A, v1, Complex(0.), result)

println(norm(result-A*v1))

@time mm1(Complex(1.), v1, A, Complex(0.), result)
@time mm1(Complex(1.), v1, A, Complex(0.), result)

println(norm(result-v1*A))

@time mm2(Complex(1.), v1, A, Complex(0.), result)
@time mm2(Complex(1.), v1, A, Complex(0.), result)

println(norm(result-v1*A))

ext: jl


text:
module PulseController

# Bring in other files as submodules.  Every file is exactly one module.
# The dependency tree is as follows:

# Clifford - standalone
# Waveforms - standalone

# Qubits - imports from Clifford and Waveforms

# Seqeuncing - imports from Qubits

# ParticleSwarm - standalone

# Orbit - imports from Sequencing and ParticleSwarm

include("clifford.jl")
include("waveforms.jl")
include("qubits.jl")
include("sequencing.jl")
include("particleswarm.jl")
include("orbit.jl")

using .ORBIT # Carries all other modules
export sendSequence

# For writing out sequences, we will provide all of the pulse names.  Hopefully
# having these in scope doesn't clash with user variables
import .Clifford: Idle, Xpi, Xpi2, X3pi2, Ypi, Ypi2, Y3pi2, Zpi, Zpi2, Z3pi2, CZ
export Idle, Xpi, Xpi2, X3pi2, Ypi, Ypi2, Y3pi2, Zpi, Zpi2, Z3pi2, CZ

# From qubits
export Qubit
export cosInit
export gaussInit
export generalInit

# From waveforms, for setting qubit waveforms manually
export FloatWaveform
export ExactWaveform

end # End module PulseController

using PulseController # Bad style probably


text:
__precompile__()
module Comp

import DataStructures: counter
using SeqHax.Utils
using ArgParse
using Bio.Seq

function add_args(argparser)
    add_common_args(argparser["comp"])
    @add_arg_table argparser["comp"] begin
        "input"
            help = "Input FASTQ read file(s) (may be gzipped)"
            required = true
            nargs = '+'
            arg_type = String
    end
end

function main(args)
    comp = []

    for readfile in args["input"]
        npair = foreach_read(readfile, quiet=args["quiet"]) do idx, read
            while length(comp) < length(read.seq)
                push!(comp, counter(DNANucleotide))
            end
            for (i, base) in enumerate(read.seq)
                if isambiguous(base)
                    push!(comp[i], DNA_N)
                else
                    push!(comp[i], base)
                end
            end
        end
        println(STDERR, "Finished '$readfile'")
    end
    println("cycle\tA\tC\tG\tT\tN")
    for (i, ctr) in enumerate(comp)
        A, C, G, T, N = [ctr[b] for b in [DNA_A, DNA_C, DNA_G, DNA_T, DNA_N]]
        println("$i\t$A\t$C\t$G\t$T\t$N")
    end
end

end # module Comp


text:
module NastranResults

using SparseArrays
using FortranFiles

import Base.collect

export readop4, readpch, PunchModalData, PunchFrequencyData

include("misc.jl")
include("op4.jl")
include("hdf5.jl")
include("pch.jl")

end

max_stars_repo_name: mgcth/SDNastran

max_issues_repo_name: mgcth/SDNastran

max_forks_repo_name: mgcth/SDNastran


text:
# Power cone constrained problems
using Test, LinearAlgebra, SparseArrays
using COSMO

@testset "Power cone problems" begin

    @testset "Feasible" begin

        # solve the following power cone problem
        # max  x1^0.6 y^0.4 + x2^0.1
        # s.t. x1, y, x2 >= 0
        #      x1 + 2y  + 3x2 == 3
        # which is equivalent to
        # max z1 + z2
        # s.t. (x1, y, z1) in K_pow(0.6)
        #      (x2, 1, z2) in K_pow(0.1)
        #      x1 + 2y + 3x2 == 3

        # x = (x1, y, z1, x2, y2, z2)
        n = 6
        P = spzeros(n, n)
        q = zeros(6)
        q[3] = q[6] = -1.

        # (x1, y, z1) in K_pow(0.6)
        A1 = sparse(Matrix(1.0I, 3, 3))
        b1 = zeros(3)
        cs1 = COSMO.Constraint(A1, b1, COSMO.PowerCone(0.6), 6, 1:3)

        # (x2, 2, z2) in K_pow(0.1)
        A2 = sparse(Matrix(1.0I, 3, 3))
        b2 = zeros(3)
        cs2 = COSMO.Constraint(A2, b2, COSMO.PowerCone(0.1),6, 4:6)

        # x1 + 2y + 3x2 == 3
        cs3 = COSMO.Constraint([1.0 2.0 0 3.0 0 0], [-3.], COSMO.ZeroSet)

        # y2 == 1
        cs4 = COSMO.Constraint([0 0 0 0 1.0 0], [-1.], COSMO.ZeroSet)

        model = COSMO.Model()
        assemble!(model, P, q, [cs1; cs2; cs3; cs4])

        res = COSMO.optimize!(model)
        @test res.status == :Solved
        @test isapprox(res.obj_val, -1.8458, atol=1e-3)

        # using JuMP
        # m = Model(with_optimizer(COSMO.Optimizer))
        # @variable(m, x1)
        # @variable(m, y)
        # @variable(m, z1)
        # @variable(m, x2)
        # @variable(m, y2 == 1.)
        # @variable(m, z2)

        # @objective(m, Max, z1 + z2)
        # @constraint(m, x1 + 2 * y + 3 * x2 == 3)
        # @constraint(m, [x1; y; z1] in MOI.PowerCone(0.6))
        # @constraint(m, [x2; y2; z2] in MOI.PowerCone(0.1))
        # status = JuMP.optimize!(m)

    end

    @testset "Primal infeasible" begin
        # max  z
        # s.t. x^0.8 * y^0.2 >= z
        #       x = y == 1
        #       z = 2

        P = spzeros(3, 3)
        q = [0; 0; -1.0]

        cs1 = COSMO.Constraint(Matrix(1.0I, 3, 3), zeros(3), COSMO.PowerCone(0.8))
        cs2 = COSMO.Constraint(Matrix(1.0I, 3, 3), [-1.; -1.; -2.], COSMO.ZeroSet)

        model = COSMO.Model()
        assemble!(model, P, q, [cs1; cs2])

        res = COSMO.optimize!(model)

        @test res.status == :Primal_infeasible
    end

    @testset "Dual infeasible" begin
        # min z
        # s.t. x^0.8 * y^0.2 >= z

        P = spzeros(3, 3)
        q = [0; 0; 1.0]

        cs1 = COSMO.Constraint(Matrix(1.0I, 3, 3), zeros(3), COSMO.PowerCone(0.8))

        model = COSMO.Model()
        assemble!(model, P, q, cs1)

        res = COSMO.optimize!(model)
        @test res.status == :Dual_infeasible
    end

end

@testset "Dual power cone problems" begin
    @testset "Feasible" begin
        # max  z
        # s.t. (x/0.8)^0.8 * (y/0.2)^0.2 >= z
        #       x == 0.8,  y == 0.2
        P = spzeros(3, 3)
        q = [0.; 0.; -1]

        # (x, y, z) in K^*_pow(0.8)
        A1 = sparse(Matrix(1.0I, 3, 3))
        b1 = zeros(3)
        cs1 = COSMO.Constraint(A1, b1, COSMO.DualPowerCone(0.8))

        # x == 0.8, y == 0.2
        cs2 = COSMO.Constraint([1. 0 0; 0 1 0], [-0.8; -0.2], COSMO.ZeroSet)

        model = COSMO.Model()
        assemble!(model, P, q, [cs1; cs2])

        res = COSMO.optimize!(model)
        @test res.status == :Solved
        @test isapprox(res.obj_val, -1., atol=1e-3)

    end
end

nothing


text:
# SCALING
#
# PART OF BAZINGA.jl

using LinearAlgebra

"""
    objgradscaling()
returns a scaling factor `σ` for an objective function `f` at a given point `x`
such that the gradient of `F := σ f` at `x` does not exceed `scaling_grad_max` or,
if requested, is `scaling_grad_target`, whenever allowed by `scaling_min_value`.
"""
function objgradscaling(
    grad_f_x::Tx,
    grad_target::Maybe{R},
    grad_max::R,
    min_value::R,
) where {R<:Real,Tx<:AbstractVector{R}}
    max_grad_f = norm(grad_f_x, Inf)
    if grad_target === nothing
        s = min(R(1), grad_max / max_grad_f)
    else
        if max_grad_f == 0
            s = R(1)
            if warnings
                @warn "Gradient of smooth objective function is zero at starting point.
                Cannot determine scaling factor based on `scaling_grad_target` option."
            end
        else
            s = grad_target / max_grad_f
        end
    end
    return max(s, min_value)
end


text:
# load required modules
using CategoricalArrays
using CSV
using DataFrames
using Distributions
using Plots
using Random
using StatsBase

# set seed for reproducible sequence of numbers
Random.seed!(42);

# draw 1000 observations from a normal distribuition
# of mean 100 and standard deviation 10
xnorm = rand(Normal(100, 10), 1000)
histogram(xnorm)

# draw 1000 observations from a uniform distribuition
# of minimum 0 and maximum 10
xunif = rand(Uniform(0, 10), 1000)
histogram(xunif)

# draw 1000 observation from bernoulli distribution with
# probability of success 0.3
xbern = rand(Bernoulli(0.3), 1000)
histogram(xbern)

# draw 1000 observation from binomial distribution with
# probability of success 0.3 and 30 number of trials
xbin = rand(Binomial(30, 0.3), 1000)
histogram(xbin)

# draw 1000 observations from a poisson distribuition
# of average rate of occurrence 100
xpoiss = rand(Poisson(100), 1000)
histogram(xpoiss)

max_stars_repo_name: lykmapipo/data-science-learning

max_issues_repo_name: lykmapipo/data-science-learning

max_forks_repo_name: lykmapipo/data-science-learning


text:
export softmax!, ∇softmax!
export CUDNN_SOFTMAX_FAST, CUDNN_SOFTMAX_ACCURATE, CUDNN_SOFTMAX_LOG # algorithm
export CUDNN_SOFTMAX_MODE_INSTANCE, CUDNN_SOFTMAX_MODE_CHANNEL # mode

function softmax!{T}(mode, x::CuArray{T}, y::CuArray{T};
  algo=CUDNN_SOFTMAX_ACCURATE, alpha=1.0, beta=0.0)

  h = gethandle(x.dev)
  xdesc = TensorDesc(x)
  ydesc = TensorDesc(y)
  cudnnSoftmaxForward(h, algo, mode, T[alpha], xdesc, x, T[beta], ydesc, y)
  y
end

function ∇softmax!{T}(mode, y::CuArray{T}, dy::CuArray{T}, dx::CuArray{T};
  algo=CUDNN_SOFTMAX_ACCURATE, alpha=1.0, beta=0.0)

  h = gethandle(x.dev)
  ydesc = TensorDesc(y)
  dydesc = TensorDesc(dy)
  dxdesc = TensorDesc(dx)
  cudnnSoftmaxBackward(h, algo, mode, T[alpha], ydesc, y, dydesc, dy,
    T[beta], dxdesc, dx)
  dx
end


text:
## ------------------------------------------------------------
# Inspired in DrWatson: quickactivate but reduce LOAD_PATH
function quickactivate(path = pwd(), name = "")

    # setup
    path = string(path)
    name = string(name)

    # find project
    path = abspath(path)
    currproj = Base.current_project(path)
    (isnothing(currproj) || !isfile(currproj)) && error("No project found from '$(path)'")

    # check name
    projname = basename(dirname(currproj))
    !isempty(name) && (projname != name) && error("Unexpected project name, expected '$(name)' got '$(projname)'")

    # activate
    actproj = Base.active_project()
    (currproj != actproj) && Pkg.activate(currproj)

    # restrict LOAD_PATH
    empty!(LOAD_PATH)
    push!(LOAD_PATH, "@", "@stdlib")

    return nothing
end

# ------------------------------------------------------------
macro quickactivate(name = nothing)
    path = String(__source__.file)
    !ispath(path) && (path = pwd())
    name = isnothing(name) ? "" : string(name)
    quickactivate(path, name)
    return :(nothing)
end


text:
function fastZipFileRead(file, T)
    bytes = file.uncompressedsize
    v = Vector{UInt8}(undef, bytes)

    # Directories have 0 bytes, ignore
    if bytes > 0
        read!(file, v)
    end

    return T(v)
end

function fastZipFileRead(file)
    bytes = file.uncompressedsize
    v = Vector{UInt8}(undef, bytes)

    # Directories have 0 bytes, ignore
    if bytes > 0
        read!(file, v)
    end

    return v
end

max_stars_repo_name: CelestialCartographers/Ahorn

max_issues_repo_name: CelestialCartographers/Ahorn

max_forks_repo_name: CelestialCartographers/Ahorn


text:
using Documenter, AVExamples
makedocs(modules=[AVExamples],
doctest=false, clean=true,
format =:html,
authors="Huckleberry Febbo",
assets = ["assets/style.css"],
sitename="MAVs",
pages = [
    "Home" => "index.md",
    "Usage" => [
        "Basic usage" => "tutorials/basic.md",
        "Developing MAVs" => "tutorials/developer.md",
    ],
    "Sensing" => [
        "vehicle_description" => "packages/model/gazebo/vehicle_description/main.md",
        "contact_sensor" => "packages/model/gazebo/contact_sensor/main.md",
    ],
    "Detection" => [
        "obstacle_detector" => "packages/computing/perception/obstacle_detector/main.md",
    ],
    "Vehicle model" => [
        "ros_chrono" => "packages/model/chrono/ros_chrono/main.md",
    ],
    "Planning" => [
        "nloptcontrol_planner" => "packages/computing/planning/nloptcontrol_planner/main.md",
        "mavs_ros_planner" => "packages/computing/planning/mavs_ros_planner/main.md",
    ],
    "Miscellaneous" => [
        "system_shutdown" => "packages/system/system_shutdown.md",
        "data_logging" => "packages/system/data_logging.md",
        "chrono_position_broadcaster" => "packages/model/chrono/chrono_position_broadcaster/main.md",
        "ros_chrono_msgs" => "packages/model/chrono/ros_chrono_msgs/main.md",
        "point_cloud_converter" => "packages/computing/perception/point_cloud_converter.md",
    ],
    "System demos" => [
        "demoA" => "packages/system/demos/demoA.md",
        "demoB" => "packages/system/demos/demoB.md",
        "demoC" => "packages/system/demos/demoC.md",
        "demoD" => "packages/system/demos/demoD.md",
        "demoE" => "packages/system/demos/demoE.md",
        "demoF" => "packages/system/demos/demoF.md",
        "demoG" => "packages/system/demos/demoG.md",
    ],
    "Docker" => [
        "Workflow" => "docker/workflow.md",
        "Notes" => "docker/notes.md",
    ],
    "Testing"  => "testing/main.md",
    "Troubleshooting"  => "issues/main.md",
]
)

deploydocs(
    deps=Deps.pip("mkdocs","python-markdown-math"),
    repo="github.com/JuliaMPC/AVExamples.jl.git",
    target="build",
    osname="linux",
    julia="0.6",
    make=nothing)


text:
using OctaveREPL
using Documenter

DocMeta.setdocmeta!(OctaveREPL, :DocTestSetup, :(using OctaveREPL); recursive=true)

makedocs(;
    modules=[OctaveREPL],
    authors="Rehmi Post <rehmi.post@gmail.com> and contributors",
    repo="https://github.com/rehmi/OctaveREPL.jl/blob/{commit}{path}#{line}",
    sitename="OctaveREPL.jl",
    format=Documenter.HTML(;
        prettyurls=get(ENV, "CI", "false") == "true",
        assets=String[],
    ),
    pages=[
        "Home" => "index.md",
    ],
)


text:
function solveKnapModel(data::KnapData, optimizer)
    I = collect(1:length(data.items))
    W = data.capacity
    w = [ item.weight for item in data.items ]
    p = [ item.profit for item in data.items ]

    model = Model(optimizer)

    @variable(model, x[j in I], Bin)
    @objective(model, Max, sum(p[j] * x[j] for j in I))
    @constraint(model, sum(w[j] * x[j] for j in I) <= W)

    optimize!(model)
    if termination_status(model) == MOI.OPTIMAL
        result = [ j for j in I if value(x[j]) > EPS ]
        return round(Int64, objective_value(model)), result
    end
end


text:
#Installs SnFFT using Julia's package manager and then runs the examples

#Open Terminal and change directories to the location of this file
#Start an interactive julia session
#Run:
#	require("InitialSetUp.jl")

Pkg.update()
Pkg.add("SnFFT")
using SnFFT
example1()
println("")
example2()
println("")
example3()
println("")
example4()
println("")
example5()
println("")
example6()
println("")
example7()
println("")
example8()


text:
using PeatUtils
using Base.Test
using GDAL

# reuse GDAL.jl test data
tifpath = joinpath(Pkg.dir("GDAL"), "test", "data", "utmsmall.tif")
tifpath_local = joinpath(dirname(@__FILE__), "data", "utmsmall.tif")

cp(tifpath, tifpath_local, remove_destination=true)

@test getnodata(tifpath) == -1.0e10

nodata = -9999.0
setnodata!(tifpath_local, nodata)
@test getnodata(tifpath_local) == nodata

# test pointsample()
let
    GDAL.allregister()
    dataset = GDAL.open(tifpath_local, GDAL.GA_ReadOnly)
    geotransform = zeros(6)
    GDAL.getgeotransform(dataset, geotransform)
    band = GDAL.getrasterband(dataset, 1)

    @test pointsample(band, geotransform, 443334.9, 3750015.9) === UInt8(189)
    @test pointsample(band, geotransform, 443167.9, 3749928.3) === UInt8(173)

    GDAL.close(dataset)
    GDAL.destroydrivermanager()
end

A, x_min, y_max, cellsize, epsg, nodata = read_raster(tifpath_local)

@test x_min === 440720.0
@test y_max === 3.75132e6
@test cellsize === 60.0
@test epsg === Nullable{Int64}(26711)
@test nodata === -9999.0

tifpath_local_out = joinpath(dirname(@__FILE__), "data", "utmsmall_out.tif")
write_raster(tifpath_local_out, A, x_min, y_max, cellsize; epsg=epsg)

ref_wkt_utm48n = """PROJCS["WGS 84 / UTM zone 48N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",105],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32648"]]"""
ref_epsg_utm48n = Nullable(32648)
@test epsg2wkt(ref_epsg_utm48n) == ref_wkt_utm48n
@test wkt2epsg(ref_wkt_utm48n) === ref_epsg_utm48n

rm(tifpath_local)
rm(tifpath_local_out)

# test without projection information
# A, x_min, y_max, cellsize, epsg, nodata = read_raster("a.tif")
# @test isnull(epsg)
# @test isa(epsg, Nullable{Int})


text:
function sortmerge!(v1, v2, ret, iend, jend)
   retind = 0
   i,j = firstindex(v1), firstindex(v2)
   @inbounds while i <= iend || j <= jend
      if j > jend
         ret[retind += 1] = v1[i]
         i+=1
         continue
      elseif i > iend
         ret[retind += 1] = v2[j]
         j+=1
         continue
      end
      if v1[i] == v2[j]
         error("The two vectors are not supposed to have overlapping values")
      elseif j > lastindex(v2) || v1[i] < v2[j]
         ret[retind += 1] = v1[i]
         i+=1
      elseif i > lastindex(v1) || v1[i] > v2[j]
         ret[retind += 1] = v2[j]
         j+=1
      end
   end
end

function _interdif!(v1, v2, inter, dif)
   nshared, ndiff = 0, 0
   i,j = firstindex(v1), firstindex(v2)
   @inbounds while i <= lastindex(v1) || j <= lastindex(v2)
      if j > lastindex(v2)
         dif[ndiff += 1] = v1[i]
         i+=1
         continue
      elseif i > lastindex(v1)
         dif[ndiff += 1] = v2[j]
         j+=1
         continue
      end
      if v1[i] == v2[j]
         inter[nshared += 1] = v1[i]
         i += 1
         j += 1
      elseif j > lastindex(v2) || v1[i] < v2[j]
         dif[ndiff += 1] = v1[i]
         i+=1
      elseif i > lastindex(v1) || v1[i] > v2[j]
         dif[ndiff += 1] = v2[j]
         j+=1
      end
   end
   ndiff, nshared
end

function _curveball!(m::SparseMatrixCSC{Bool, Int}, rng = Random.GLOBAL_RNG)
   R, C = size(m)
   mcs = min(2maximum(diff(m.colptr)), size(m, 1))
   not_shared, shared = Vector{Int}(undef, mcs), Vector{Int}(undef, mcs)
   newa, newb = Vector{Int}(undef, mcs), Vector{Int}(undef, mcs)

   for rep ∈ 1:5C
	   A, B = rand(rng, 1:C,2)

      # use views directly into the sparse matrix to avoid copying
	   a, b = view(m.rowval, m.colptr[A]:m.colptr[A+1]-1), view(m.rowval, m.colptr[B]:m.colptr[B+1]-1)
	   l_a, l_b = length(a), length(b)

      # an efficient algorithm since both a and b are sorted
      l_dif, l_ab = _interdif!(a, b, shared, not_shared)

	   if !(l_ab ∈ (l_a, l_b))
            L = l_a - l_ab

			   sample!(rng, view(not_shared, Base.OneTo(l_dif)), view(newa,Base.OneTo(L)), replace = false, ordered = true)
            L2,_ = _interdif!(view(newa, 1:L), view(not_shared, Base.OneTo(l_dif)), newa, newb)

			   sortmerge!(shared, newa, a, l_ab, L)
			   sortmerge!(shared, newb, b, l_ab, L2)
	   end
   end

   return m
end


text:
using Zygote, LinearAlgebra
using KrylovKit: eigsolve

# helper for `herm`
function f(x, y, i, j)
    if i == j
        return x/2 + im*zero(y)
    elseif i > j
        return x + im * y
    elseif i < j
        return zero(x) + im*zero(y)
    end
end

# helper for invherm
function finv(z, i, j)
    if i <= j
        return real(z)
    elseif i > j
        return imag(z)
    end
end

# Create a complex `d` by `d` Hermitian matrix from a `d^2`-dimensional real vector `v`
function herm(v::AbstractVector)
    d = isqrt(length(v))
    @assert d^2 == length(v)
    m = reshape(v, d, d)
    m = [ f(m[i,j], m[j,i], i, j) for i = 1:d, j = 1:d]
    m = m + m'
    return m
end

# Recover the vector representation
function invherm(A::AbstractMatrix)
    d = size(A,1)
    m = [ finv(A[i,j], i, j) for i = 1:d for j = 1:d ]
    return vec(m)
end

# Find the minimal eigenvalue using KrylovKit (from a vector representation)
function eigmin_vec(v::AbstractVector)
    A = herm(v)
    eigsolve(A, 1, :SR)[1][1] |> real
end

# Give an adjoint for `Zygote`, which technically only works in the non-degenerate case
Zygote.@adjoint function eigmin_vec(v::AbstractVector)
    A = herm(v)
    eigs = eigsolve(A, 1, :SR)
    eval = eigs[1][1]
    evec = eigs[2][1]
    adj = (evec * evec') |> invherm
    return eval |> real, c->(c * adj,)
end

A = rand(4, 4); A = A + A';
v = invherm(A)

@show eigmin(A)
@show eigmin_vec(v)
@show Zygote.gradient(eigmin_vec, v)

max_stars_repo_path: Methods/@adjoint (real rep of Hermitian).jl

max_stars_repo_name: ericphanson/Attempt-diff-eigmin

max_issues_repo_name: ericphanson/Attempt-diff-eigmin

max_forks_repo_name: ericphanson/Attempt-diff-eigmin


text:
"""
**ADBM parameters**
"""
function adbm_parameters(parameters, e, a_adbm, ai, aj, b, h_adbm, hi, hj, n, ni, Hmethod, Nmethod)
    parameters[:e] = e
    parameters[:a_adbm] = a_adbm
    parameters[:ai] = ai
    parameters[:aj] = aj
    parameters[:b] = b
    parameters[:h_adbm] = h_adbm
    parameters[:hi] = hi
    parameters[:hj] = hj
    parameters[:n] = n
    parameters[:ni] = ni
    #check Hmethod
    if Hmethod ∈ [:ratio, :power]
      parameters[:Hmethod] = Hmethod
    else
      error("Invalid value for Hmethod -- must be :ratio or :power")
    end
    # check Nmethod
    if Nmethod ∈ [:original, :biomass]
      parameters[:Nmethod] = Nmethod
    else
      error("Invalid value for Nmethod -- must be :original or :biomass")
    end
    # add empty cost matrix
    S = size(parameters[:A],2)
    parameters[:costMat] = ones(Float64,(S,S))
end

"""
**ADBM Terms**
This function takes the parameters for the ADBM model and returns
the final terms used to determine feeding patterns. It is used internally by  ADBM().
"""
function get_adbm_terms(S::Int64, parameters::Dict{Symbol,Any}, biomass::Vector{Float64})
  E = parameters[:e] .* parameters[:bodymass]
  if parameters[:Nmethod] == :original
    N = parameters[:n] .* (parameters[:bodymass] .^ parameters[:ni])
  elseif parameters[:Nmethod] == :biomass
    N = biomass
  end
  A_adbm = parameters[:a_adbm] * (parameters[:bodymass].^parameters[:aj]) * (parameters[:bodymass].^parameters[:ai])' # a * pred * prey
  for i = 1:S #for each prey
    A_adbm[:,i] = A_adbm[:,i] .* N[i]
  end
  λ = A_adbm
  if parameters[:Hmethod] == :ratio
    H = zeros(Float64,(S,S))
    ratios = (parameters[:bodymass] ./ parameters[:bodymass]')' #PREDS IN ROWS : PREY IN COLS
    for i = 1:S , j = 1:S
      if ratios[j,i] < parameters[:b]
      H[j,i] =  parameters[:h_adbm] / (parameters[:b] - ratios[j,i])
      else
      H[j,i] = Inf
      end
    end
  elseif parameters[:Hmethod] == :power
    H = parameters[:h_adbm] * (parameters[:bodymass].^parameters[:hj]) * (parameters[:bodymass].^parameters[:hi])' # h * pred * prey
  end

  adbmTerms = Dict{Symbol,Any}(
  :E => E,
  :λ => λ,
  :H => H)

  return(adbmTerms)
end

"""
**ADBM Feeding Links**
This function takes the terms calculated by getADBM_Terms() and uses them to determine the feeding
links of species j. Used internally by ADBM().
"""
function get_feeding_links(S::Int64,E::Vector{Float64}, λ::Array{Float64},
   H::Array{Float64},biomass::Vector{Float64},j)

  profit = E ./ H[j,:]
  # Setting profit of species with zero biomass  to -1.0
  # This prevents them being included in the profitSort
  profit[vec(biomass .== 0.0)] .= -1.0

  profs = sortperm(profit,rev = true)

  λSort = λ[j,profs]
  HSort = H[j,profs]
  ESort = E[profs]

  λH = cumsum(λSort .* HSort)
  Eλ = cumsum(ESort .* λSort)

  λH[isnan.(λH)] .= Inf
  Eλ[isnan.(Eλ)] .= Inf

  cumulativeProfit = Eλ ./ (1 .+ λH)

  if all(0 .== cumulativeProfit)
  feeding = []
  else
  feeding = profs[1:maximum(findall(cumulativeProfit .== maximum(cumulativeProfit)))]
  end

  #cumulativeProfit[end] = NaN
  #feeding = profs[(append!([true],cumulativeProfit[1:end-1] .< profitSort[2:end]))]
  return(feeding)
end

"""
**ADBM Web**
This function returns the food web based on the ADBM model of Petchey et al. 2008. The function
takes the paramteres created by rewire_parameters() and uses getADBM_Terms() and getFeedingLinks() to
detemine the web structure. This function is called using the callback to include rewiring into biomass simulations.
"""
function ADBM(S::Int64,parameters::Dict{Symbol,Any},biomass::Vector{Float64})
  adbmMAT = zeros(Int64,(S,S))
  adbmTerms = get_adbm_terms(S,parameters,biomass)
  E = adbmTerms[:E]
  λ = adbmTerms[:λ]
  H = adbmTerms[:H]
  for j = 1:S
    if !parameters[:is_producer][j]
      if biomass[j] > 0.0
        feeding = get_feeding_links(S,E,λ,H,biomass,j)
        adbmMAT[j,feeding] .= 1
      end
    end
  end
  return(adbmMAT)
end

max_stars_repo_name: SimmonsBI/BioEnergeticFoodWebs

max_issues_repo_name: SimmonsBI/BioEnergeticFoodWebs

max_forks_repo_name: SimmonsBI/BioEnergeticFoodWebs


text:
S = randSeisData(3, s=1.0, nx=1024)
@test mkchans(1, S) == [1]
@test mkchans(1:2, S) == [1, 2]
@test mkchans([2,3], S) == [2, 3]

S.x[2] = Float64[]
@test mkchans([2,3], S) == [3]

S.t[3] = Array{Int64, 2}(undef, 0, 2)
@test mkchans(1:3, S, f=:t) == [1,2]
@test mkchans(1:3, S) == [1,3]

S.t[3] = [1 S.t[1][1,2]; length(S.x[3]) 0]
push!(S, randSeisChannel(c=true))
@test mkchans(1:4, S, keepirr=false) == [1, 3]
@test mkchans([2,3,4], S, keepirr=false) == [3]

S = randSeisData(3, s=1.0, nx=1024)
@test get_seis_channels(S, chans=3) == [3]
@test get_seis_channels(S, chans=1:2) == [1,2]
@test get_seis_channels(S, chans=[1,3]) == [1,3]

cr = [1,2,3]
c0 = deepcopy(cr)
filt_seis_chans!(cr, S)
@test cr == c0

S.id[1] = "...0"
filt_seis_chans!(cr, S)
@test cr != c0
@test cr == [2,3]

printstyled("channel_match\n", color=:light_green)
C = SeisChannel()
D = SeisChannel()
@test channel_match(C, D)

C = randSeisChannel(s=true)
D = deepcopy(C)
C.gain = D.gain*0.5
@test channel_match(C, D) == false
@test channel_match(C, D, use_gain = false) == true

C.gain = D.gain
C.fs = D.fs*0.5
@test channel_match(C, D) == false

printstyled("cmatch_p!\n", color=:light_green)
C = randSeisChannel(s=true)
D = deepcopy(C)
C0 = deepcopy(C)

# Scenarios that must work:
# C set, D unset
D.fs = 0.0
D.gain = 1.0
D.loc = GeoLoc()
D.resp = PZResp()
D.units = ""
m = cmatch_p!(C,D)
@test m == true
@test channel_match(C, D) == true

# D set, C unset
C.fs = 0.0
C.gain = 1.0
C.loc = GeoLoc()
C.resp = PZResp()
C.units = ""
m = cmatch_p!(C,D)
@test m == true
@test channel_match(C, D) == true

# Values must preserve those in C0
@test channel_match(C, C0) == true

# Scenarios that must fail
C = randSeisChannel(s=true)
C.loc = GeoLoc(lat = 48.79911, lon=-122.54064, el=45.1104)
C.resp = PZResp(a0 = 223.43015f0, f0 = 2.0f0, p = ComplexF32.([-8.89+8.89im, 8.89-8.89im]))
C0 = deepcopy(C)

D = deepcopy(C0)
while D.units == C.units
  D.units = randstring()
end
@test cmatch_p!(C,D) == false
@test C == C0

D = deepcopy(C0)
D.fs = 2.0*C.fs
D0 = deepcopy(D)
@test cmatch_p!(C,D) == false
@test C == C0
@test D == D0

D = deepcopy(C0)
D.gain = 2.0*C.gain
D0 = deepcopy(D)
@test cmatch_p!(C,D) == false
@test C == C0
@test D == D0

D = deepcopy(C0)
D.loc.lat = 89.1
D0 = deepcopy(D)
@test cmatch_p!(C,D) == false
@test C == C0
@test D == D0

D = deepcopy(C0)
D.resp.f0 = 1.0f0
D0 = deepcopy(D)
@test cmatch_p!(C,D) == false
@test C == C0
@test D == D0


text:
export DynaAgent

Base.@kwdef struct DynaAgent{P,M,T} <: AbstractPolicy
    policy::P
    model::M
    trajectory::T
    plan_step::Int = 10
end

(p::DynaAgent)(env::AbstractEnv) = p.policy(env)

function (agent::DynaAgent)(stage::AbstractStage, env::AbstractEnv)
    update!(agent.trajectory, agent.policy, env, stage)
    dyna_update!(agent, env, stage)
end

function (agent::DynaAgent)(stage::PreActStage, env::AbstractEnv, action)
    update!(agent.trajectory, agent.policy, env, stage, action)
    dyna_update!(agent, env, stage)
end

function dyna_update!(agent, env, stage)
    # 1. model learning
    update!(agent.model, agent.trajectory, agent.policy, env, stage)
    # 2. direct learning
    update!(agent.policy, agent.trajectory, env, stage)
    # 3. policy learning
    for _ in 1:agent.plan_step
        update!(agent.policy, agent.model, agent.trajectory, env, stage)
    end
end

# 1. model learning
# By default we do nothing
function RLBase.update!(
    ::AbstractEnvironmentModel,
    ::AbstractTrajectory,
    ::AbstractPolicy,
    ::AbstractEnv,
    ::AbstractStage,
) end

# 3. policy learning
# By default we do nothing
function RLBase.update!(
    ::AbstractPolicy,
    ::AbstractEnvironmentModel,
    ::AbstractTrajectory,
    ::AbstractEnv,
    ::AbstractStage,
) end


text:
struct PyNoneType <: PyObject end
struct PyIntType <: PyObject end
struct PyFloatType <: PyObject end
struct PyBoolType <: PyObject end
struct PyComplexType <: PyObject end
struct PyListType <: PyObject end
struct PyTupleType <: PyObject end
struct PyDictType <: PyObject end
struct PySetType <: PyObject end
struct PyFrozenSetType <: PyObject end
struct PyStrType <: PyObject end
struct PyBytesType <: PyObject end
struct PyByteArrayType <: PyObject end
struct PyRangeType <: PyObject end
struct PySliceType <: PyObject end
struct PyTypeType <: PyObject end
struct PyFractionType <: PyObject end
struct PyArrayType <: PyObject end
struct PyArrayReconstructor <: PyObject end
struct PyDateType <: PyObject end
struct PyTimeType <: PyObject end
struct PyDateTimeType <: PyObject end
struct PyNumPyDTypeType <: PyObject end
struct PyNumPyNDArrayType <: PyObject end

export PyNoneType, PyIntType, PyFloatType, PyBoolType, PyComplexType, PyListType,
    PyTupleType, PyDictType, PySetType, PyFrozenSetType, PyStrType, PyBytesType,
    PyByteArrayType, PyRangeType, PySliceType, PyFractionType, PyArrayType,
    PyArrayReconstructor, PyDateType, PyTimeType, PyDateTimeType, PyNumPyDTypeType,
    PyNumPyNDArrayType

const GLOBALS = Dict{Tuple{String,String},Any}(
    ("builtins", "NoneType") => PyNoneType(),
    ("builtins", "int") => PyIntType(),
    ("builtins", "float") => PyFloatType(),
    ("builtins", "bool") => PyBoolType(),
    ("builtins", "complex") => PyComplexType(),
    ("builtins", "list") => PyListType(),
    ("builtins", "tuple") => PyTupleType(),
    ("builtins", "dict") => PyDictType(),
    ("builtins", "set") => PySetType(),
    ("builtins", "frozenset") => PyFrozenSetType(),
    ("builtins", "str") => PyStrType(),
    ("builtins", "bytes") => PyBytesType(),
    ("builtins", "bytearray") => PyByteArrayType(),
    ("builtins", "range") => PyRangeType(),
    ("builtins", "slice") => PySliceType(),
    ("builtins", "type") => PyTypeType(),
    ("fractions", "Fraction") => PyFractionType(),
    ("array", "array") => PyArrayType(),
    ("array", "_array_reconstructor") => PyArrayReconstructor(),
    ("datetime", "date") => PyDateType(),
    ("datetime", "time") => PyTimeType(),
    ("datetime", "datetime") => PyDateTimeType(),
    ("numpy", "dtype") => PyNumPyDTypeType(),
    ("numpy", "ndarray") => PyNumPyNDArrayType(),
)