def submit(ctxtype, graph, config=None, username=None, password=None):
streamsx._streams._version._mismatch_check(__name__)<EOL>graph = graph.graph<EOL>if not graph.operators:<EOL><INDENT>raise ValueError("<STR_LIT>".format(graph.topology.name))<EOL><DEDENT>context_submitter = _SubmitContextFactory(graph, config, username, password).get_submit_context(ctxtype)<EOL>sr = SubmissionResult(context_submitter.submit())<EOL>sr._submitter = context_submitter<EOL>return sr<EOL>
Submits a `Topology` (application) using the specified context type.

Used to submit an application for compilation into a Streams application and
execution within an Streaming Analytics service or IBM Streams instance.

`ctxtype` defines how the application will be submitted, see :py:class:`ContextTypes`.

The parameters `username` and `password` are only required when submitting to an
IBM Streams instance and it is required to access the Streams REST API from the
code performing the submit. Accessing data from views created by
:py:meth:`~streamsx.topology.topology.Stream.view` requires access to the Streams REST API.

Args:
    ctxtype(str): Type of context the application will be submitted to. A value from :py:class:`ContextTypes`.
    graph(Topology): The application topology to be submitted.
    config(dict): Configuration for the submission.
    username(str): Username for the Streams REST api.
    password(str): Password for `username`.

Returns:
    SubmissionResult: Result of the submission. For details of what is contained see the :py:class:`ContextTypes`
    constant passed as `ctxtype`.