LogoLogo
HomeWeb PlatformForum
  • User Manual
  • Get Started
    • Create a Pollination Account
    • Setting up an Organization
      • 1. Create an Organization
      • 2. Add Organization Seats
      • 3. Add Team Members
      • 4. Purchase and Manage CAD Licenses
      • 5. Manage License Pools
      • 6. Add Additional Computing Resources
    • Setting up Rhino, Grasshopper and Revit Plugins
      • Download CAD Plugins
      • Install CAD Plugins
      • Purchase and Manage CAD Plugins
      • The Difference between CAD Licenses and Organization Seats
  • REVIT PLUGIN
    • Getting Started in Revit
    • Exporting Energy Models from Revit
      • Understanding the Export Process
      • Managing Pollination Revit License
      • Setting Up Linked Models
      • Creating Snapshots
      • Editing and Exporting Snapshots
    • Modeling Best Practices
  • Model Editor
    • What is Pollination Model Editor
    • Getting Started
    • Workflows
    • Commands
      • By Use Case
        • Room Commands
          • Edit
          • Windows
          • New
          • Adjacency
          • Line
          • Visualize
        • Line Commands
        • Roof Commands
        • Model Commands
      • Alphabetically
        • 3D preview
        • Align
        • Auto align
        • Auto top ground
        • Change units
        • Convert to room2D
        • Create boundary
        • Create rooms
        • Explode polyline
        • Export roofs
        • Fill holes
        • Find adjacency gaps
        • Find roof gaps
        • Find roof intersection
        • Floor area change
        • Generate alignment axes
        • Import roofs
        • Join coplanar faces
        • Join segments
        • Merge Small Rooms
        • Merge rooms
        • Multipliers to geometry
        • Offset
        • Offset windows
        • Preview roofs
        • Pull to room
        • Remove colinear vertices
        • Remove holes
        • Remove short segments
        • Repair windows
        • Resolve roof overlaps
        • Roof to shade
        • Separate plenums
        • Set air boundaries
        • Show tilt
        • Simplify Curved Edges
        • Simplify windows
        • Snap to grid
        • Solve adjacency
        • Split
        • Split core and perimeter
        • Subtract roofs
        • Subtract rooms
        • Validate model
        • Vertically split
    • Supported File Formats
      • Export
      • Import
    • Python Script Editor
      • Your First Python Script
      • Editor Class API Documentation
      • Available Python Libraries
    • FAQ
    • Changelog
  • Rhino Plugin
    • Getting Started in Rhino
    • Modeling Best Practices
      • Create Rooms
      • Create Apertures
      • Create Doors
      • Solve Adjacency
      • Create Shade or Context
      • Editing your Model
      • Using Room Selection Mode
    • Energy Modeling
      • Assign Program Types
      • Assign Construction Sets
      • Assign HVAC Systems
      • Energy Settings and Parameters
      • Run Simulation and Load Results
    • Daylight Modeling
      • Assign Modifier Sets
      • Assign Modifiers
      • Add Sensor Grid
      • Add View
      • Run Simulation and Visualize Daylighting Results
    • Interoperability
      • Ladybug Tools Grasshopper Plugins
        • Entity components
      • Import
        • Import HBJSON
        • Import gbXML
        • Import OSM
        • Import IDF
      • Export
        • Export HBJSON
        • Export gbXML
        • Export OSM and IDF
    • Troubleshooting
      • Rhino Plugin Errors
      • Validation Error Codes
    • Pollination Commands
      • By Use Case
        • General
        • Geometry Setup
        • Model Alignment & Updates
        • Setup & Run Simulation
        • Load, Visualize, and Export Results
      • Alphabetically
        • PO_AddApertureShades
        • PO_AddApertures
        • PO_AddAperturesByWWR
        • PO_AddBuildingShades
        • PO_AddDoors
        • PO_AddOpaqueFaces
        • PO_AddRadialGrid
        • PO_AddRooms
        • PO_AddRoomsByLayer
        • PO_AddSensorGrid
        • PO_AddShades
        • PO_AddSiteContext
        • PO_AddSkylightsByRatio
        • PO_AddView
        • PO_Align2DPlans
        • PO_AlignInElevation
        • PO_AlignInPlan
        • PO_AlignInPlan2D
        • PO_Check2DOrtho
        • PO_CheckAdjacency
        • PO_CheckPlanarity
        • PO_CheckUpdates
        • PO_ColorByBoundaryCondition
        • PO_ColorByFaceNormal
        • PO_ColorByFaceType
        • PO_ConstructionSetManager
        • PO_ConstructionManager
        • PO_DownloadModel
        • PO_DrawApertures
        • PO_DrawDoors
        • PO_DrawPlanarSurface
        • PO_DrawRoom
        • PO_DupAperturesDoors
        • PO_EditApertureProperties
        • PO_EditDoorProperties
        • PO_EditFaceProperties
        • PO_EditInPlace
        • PO_EditProperties
        • PO_EditRoomProperties
        • PO_EditSensorGridProperties
        • PO_EditShadeProperties
        • PO_EditViewProperties
        • PO_EmbedUserLibrary
        • PO_Extrude2DPlans
        • PO_FixRoomChildrenLinks
        • PO_GenAlignGrids
        • PO_GenRoomPerimeters
        • PO_HVACManager
        • PO_IsolateAdjacencies
        • PO_LicenseManager
        • PO_LoadResults
        • PO_MaterialManager
        • PO_MatchChildGeometry
        • PO_MatchRoomProperties
        • PO_MergeRooms
        • PO_ModifierSetManager
        • PO_ModifierManager
        • PO_OffsetChildObjects
        • PO_PluginInfo
        • PO_Pollination
        • PO_ProgramTypeManager
        • PO_ProjectChildToHost
        • PO_ProjectSrf
        • PO_PurgeUserLibrary
        • PO_RebuildRooms
        • PO_RemoveProperties
        • PO_RemoveShortSegments
        • PO_RebuildAperturesDoors
        • PO_ResetBoundaryCondition
        • PO_ResetDisplayName
        • PO_ResetIdentifier
        • PO_ResetLegendLocation
        • PO_ResetResourceIDs
        • PO_RunSimulation
        • PO_SaveToUserLibrary
        • PO_SelApertures
        • PO_SelDoors
        • PO_SelOpaqueFaces
        • PO_SelRooms
        • PO_SelSensorGrids
        • PO_SelShades
        • PO_SelSiteContexts
        • PO_SelViews
        • PO_SetAirBoundariesByGuides
        • PO_SetRoomStoryByElevation
        • PO_ShowObjectNotes
        • PO_SHWManager
        • PO_ScheduleManager
        • PO_SimulationParameter
        • PO_SolveAdjacency
        • PO_SplitRooms
        • PO_SyncModel
        • PO_TestLocalAppEnvironment
        • PO_UnitsSetting
        • PO_UploadModel
        • PO_UserManual
        • PO_ValidateModel
  • Grasshopper Plugin
    • Download and Install the Grasshopper Plugin
    • Grasshopper User Interface
      • 1:Primitives
        • PO_Aperture
        • PO_Door
        • PO_Face
        • PO_Model
        • PO_Room
        • PO_SensorGrid
        • PO_Shade
        • PO_View
        • PO_VisualizationSet
        • PO_Construction
        • PO_ConstructionSet
        • PO_Material
        • PO_Modifier
        • PO_ModifierSet
        • PO_ProgramType
        • PO_Schedule
      • 2:Pollination
        • Check_Run_Inputs
        • Check_Run_Results
        • List_Run_Assets
        • Setup_Runs
        • User_Data
        • Pollinate
        • Check_Study_Status
        • List_Studies
        • Add_a_project
        • Get_a_project
        • List_Project_Assets
        • Load_Assets
        • Upload_Assets
        • Login
      • 3:Parametric
        • Fly
        • Fly_ID
      • 4:Serialization
        • PO_Dump_GEM
        • PO_Dump_IDM
        • PO_Dump_INP
        • PO_Dump_SDD
    • Your First Simulation
    • Create a Parametric Run
    • Visualize Results
  • Web Platform
    • Create a New Project
    • Manage Access to a Project
    • Create a New Study
    • Create Teams
  • Developers
    • Create an API Key
    • API
      • Add Members to an Organization
      • Create a New Project
      • Schedule a Study on Pollination
    • Apps
      • Create a Simple Chart
      • Create a Filtered Chart
      • Create a Study
      • Check Study Status
      • Download an Output
      • Visualize Results on the Web
      • Integrate the Pollination Viewer
      • Visualize Results in Rhino
      • Prepare an App folder
      • Deploy an App using the Command Line
      • Deploy an App using Github
      • Automate the App Deployment
      • Update an App
  • Legal
    • Terms of Service
    • Privacy Policy
    • Subprocessors
    • Data Processing Addendum
    • Service Level Agreement
Powered by GitBook
On this page
  • Step-1: Pollination Credentials
  • Step-2: Job Inputs
  • Step-3: Recipe Selection
  • Step-4: Recipe Inputs
  • Step-5: Scheduling a Job

Was this helpful?

  1. Developers
  2. Apps

Create a Study

PreviousCreate a Filtered ChartNextCheck Study Status

Last updated 3 months ago

Was this helpful?

In this section, we will see how you can schedule a simulation aka a job, on Pollination cloud from your Pollination app. A Job on Pollination can be created using the Pollination credentials, job inputs,and recipe inputs.

Step-1: Pollination Credentials

API key: A user of your app can find a Pollination API key in the "Developer Settings" section under the "Settings" tab of their profile on Pollination. If they don't have a key, they can generate one by entering any name for the key and clicking on the "+" button. Once they have this key, they can copy it to the clipboard and paste it back to the Pollination-app.

Owner Name: The owner name is the username of the user who is scheduling this job on Pollination. This username too can be found in the "Profile Settings" section of the "Settings" tab on Pollination. The username is typically followed by a "@" on the "Profile Settings".

Step-2: Job Inputs

Project: The project name is name of the project the scheduled job will go into. A user can create a project on Pollination by clicking on the "+" button on the navigation bar at the top. If a project already exists, the user can use that project's name.

Job name: Any text to name the job.

Job description: Any text to describe the job.

Step-3: Recipe Selection

A recipe needs to be selected and added to the project before it can be used. A recipe can be added to the project by going to the "Recipes" on the "Settings" tab of the project.

Recipe owner: The owner of the recipe. You will find several public recipes developed by the ladybug tools team on Pollination. If you develop and deploy a recipe, the owner name here will be your username.

Recipe name: Name of the recipe you want to use for the job.

Recipe tag: The version tag of the recipe you want to use for the job.

Step-4: Recipe Inputs

Step-5: Scheduling a Job

Install the following libraries first

pip install streamlit pollination-streamlit

Importing necessary libraries

import streamlit as st
from pathlib import Path
from pollination_streamlit.api.client import ApiClient
from pollination_streamlit.interactors import NewJob, Recipe

Helper function to add a recipe to a job

def add_recipe_to_job(new_job, recipe_arguments, recipe_artifacts) -> NewJob:
    """Add recipe arguments and artifacts to a job.

    args:
        new_job: A NewJob object.
        recipe_arguments: A dictionary of recipe arguments.
        recipe_artifacts: A dictionary of recipe artifacts where each items is a
            dictionary where the key is the name of the input on the recipe and the
            values are the paths to artifact and the path to the target folder on
            Pollination.

    returns:
        A NewJob object with the recipe arguments and artifacts added.
    """

    for key, val in recipe_artifacts.items():
        item = new_job.upload_artifact(
            val['file_path'], val['pollination_target_path'])
        recipe_arguments[key] = item

    new_job.arguments = [recipe_arguments]

    return new_job

Create a Streamlit form to collect inputs from the user and submit the job

with st.form('daylight-factor-job'):

    st.markdown('Pollination credentials')
    api_key = st.text_input(
        'Enter Pollination API key', type='password')
    owner = st.text_input('Project Owner')
    st.markdown('---')

    st.markdown('Job inputs')
    project = st.text_input('Project Name')
    job_name = st.text_input('Job Name')
    job_description = st.text_input('Job Description')
    st.markdown('---')

    st.markdown('Recipe selection')
    recipe_owner = st.text_input('Recipe Owner', value='ladybug-tools')
    recipe_name = st.text_input('Recipe Name', value='daylight-factor')
    recipe_tag = st.text_input('Recipe Version', value='latest')
    st.markdown('---')

    st.markdown('Recipe inputs')
    # TODO: This will change based on the recipe you select
    cpu_count = st.number_input('CPU Count', value=50)
    grid_filter = st.text_input('Grid Filter', value='*')
    min_sensor_count = st.number_input('Min Sensor Count', value=200)
    hbjson_data = st.file_uploader('Upload HBJSON')
    rad_parameters = st.text_input('Rad Parameters',
                                   value='-ab 2 -aa 0.1 -ad 2048 -ar 64')
    # TODO: change ends

    submit_button = st.form_submit_button(
        label='Submit')

    if submit_button:
        # create HBJSON file path
        hbjson_file = Path('.', 'model.hbjson')
        # write HBJSON file
        hbjson_file.write_bytes(hbjson_data.read())

        # recipe inputs
        # TODO: This will change based on the recipe you select
        arguments = {
            'cpu-count': cpu_count,
            'grid-filter': grid_filter,
            'min-sensor-count': min_sensor_count,
            'radiance-parameters': rad_parameters,
        }

        # recipe inputs where a file needs to be uploaded
        artifacts = {
            'model': {'file_path': hbjson_file, 'pollination_target_path': ''}
        }
        # TODO: change ends

        api_client = ApiClient(api_token=api_key)
        recipe = Recipe(recipe_owner, recipe_name, recipe_tag, api_client)
        new_job = NewJob(owner, project, recipe, name=job_name,
                         description=job_description, client=api_client)
        new_job = add_recipe_to_job(new_job, arguments, artifacts)
        job = new_job.create()

The above code will render the following Streamlit form that can be used to submit a job on Pollination to run the daylight-factor recipe.

Visit any on Pollination to find out the inputs for the recipe

We will create a job on Pollination to run the recipe on the gridbased model that ships with Ladybug Tools.

A job submitted using this form can be accessed .

recipe
daylight-factor
here