If you want to poll data periodically from the Dynatrace API via the classic environment SDK and ingest it into grail, then currently the best way is to go via Workflows. Because in workflows you can set the execution interval of a workflow.
For testing/developing purposes I would recommend that you develop your poll & ingest code within a custom app and an IDE of your choice because we don't have yet auto correction & quick fix features available in the workflows code editor. Copy & pasting the code snippet should work without any issues. Just make sure to add the needed imports at the begin of the code block in workflows.