def upload_resources(src_dir, project=None, folder='/', ensure_upload=False):
    applet_spec = _get_applet_spec(src_dir)

    if project is None:
        dest_project = applet_spec['project']
    else:
        dest_project = project
        applet_spec['project'] = project

    resources_dir = os.path.join(src_dir, "resources")
    if os.path.exists(resources_dir) and len(os.listdir(resources_dir)) > 0:
        target_folder = applet_spec['folder'] if 'folder' in applet_spec else folder

        # Optimistically look for a resource bundle with the same
        # contents, and reuse it if possible. The resource bundle
        # carries a property 'resource_bundle_checksum' that indicates
        # the checksum; the way in which the checksum is computed is
        # given in the documentation of _directory_checksum.

        if ensure_upload:
            properties_dict = {}
            existing_resources = False
        else:
            directory_checksum = _directory_checksum(resources_dir)
            properties_dict = dict(resource_bundle_checksum=directory_checksum)
            existing_resources = dxpy.find_one_data_object(
                project=dest_project,
                folder=target_folder,
                properties=dict(resource_bundle_checksum=directory_checksum),
                visibility='either',
                zero_ok=True,
                state='closed',
                return_handler=True
            )

        if existing_resources:
            logger.info("Found existing resource bundle that matches local resources directory: " +
                        existing_resources.get_id())

            dx_resource_archive = existing_resources
        else:
            logger.debug("Uploading in " + src_dir)

            with tempfile.NamedTemporaryFile(suffix=".tar.gz") as tar_fh:
                # The directory contents may have changed since the
                # first time we checksummed the directory. Ideally we
                # would extract the tar file to determine the checksum
                # of the actually archived files, but maybe this is a
                # little too paranoid.
                subprocess.check_call(['tar', '-C', resources_dir, '-czf', tar_fh.name, '.'])
                if 'folder' in applet_spec:
                    try:
                        dxpy.get_handler(dest_project).new_folder(applet_spec['folder'], parents=True)
                    except dxpy.exceptions.DXAPIError:
                        pass # TODO: make this better
                dx_resource_archive = dxpy.upload_local_file(
                    tar_fh.name,
                    wait_on_close=True,
                    project=dest_project,
                    folder=target_folder,
                    hidden=True,
                    properties=properties_dict
                )

        archive_link = dxpy.dxlink(dx_resource_archive.get_id())
        return [{'name': 'resources.tar.gz', 'id': archive_link}]
    else:
        return []
Ends the Application.
dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/dxpy/app_builder.py/upload_resources--crossover with--dataset/ETHPy150Open rwl/muntjac/muntjac/terminal/gwt/server/abstract_communication_manager.py/AbstractCommunicationManager.endApplication