The intensity of many of the most interesting astronomical sources (e.g., RR Lyrae stars) varies periodically as a function of time producing a "lightcurve", which can be used to classify the type of source. Since telescope time is limited, real-time source classification involves a number of decisions including carefully selecting which sources to observe, the instrument(s) to observe them with, and the future time points at which to observe them. We propose a Bayesian non-parametric hierarchical lightcurve model and use it to construct probabilistic templates for each lightcurve class by fitting it to training data. We then use these probabilistic templates to perform soft source classification and to find the optimal times at which new observations should be collected in order to improve classification. We illustrate the approach by applying it to periodic lightcurves from the Catalina Real-Time Transient Survey.