New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cloudreactor_api_client

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudreactor_api_client

  • 0.3.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

CloudReactor Ruby API client and Wrapper I/O

Gem Ruby CI GitHub Snyk Vulnerabilities for GitHub Repo

Overview

This Ruby gem consists of 2 parts:

  1. The CloudReactor API client allows ruby applications to programmatically create, monitor, and manage Tasks and Workflows in CloudReactor. Most notably, you can start and stop Tasks and Workflows by creating Task Executions and Workflow Executions.

  2. The Wrapper I/O module allows ruby applications to communicate with the CloudReactor process wrapper which is the parent process.

To install this gem, include:

gem 'cloudreactor_api_client'

in your Gemfile.

See the CloudReactor landing page to see the benefits of monitoring and managing your tasks with CloudReactor.

API client

The API client allows your program to control various entities in CloudReactor, most notably, Tasks and Workflows. The code and documentation are generated by OpenAPI generator.

To start an existing Task, create a TaskExecution linked to the Task, with a status of CloudReactorAPIClient::TaskExecutionStatus::MANUALLY_STARTED:

config = CloudReactorAPIClient::Configuration.new
config.access_token = 'YOUR API KEY'
api_client = CloudReactorAPIClient::ApiClient.new(config)

task = CloudReactorAPIClient::NameAndUuid.new
task.name = 'Sample Task'
task_execution = CloudReactorAPIClient::TaskExecution.new
task_execution.task = task
task_execution.status = CloudReactorAPIClient::TaskExecutionStatus::MANUALLY_STARTED
te_api = CloudReactorAPIClient::TaskExecutionsApi.new(api_client)
te_api.task_executions_create(task_execution)

Wrapper I/O

While running a ruby process that is wrapped by a CloudReactor process wrapper, you can use CloudReactorWrapperIO::StatusUpdater to send updates about your process to the wrapper. The wrapper will send those updates to the CloudReactor API server during its next heartbeat. Updates can include:

  • success count
  • error count
  • skipped count
  • expected count
  • last status message
  • any additional properties that can be serialized into JSON

Updates are communicated via a local UDP socket which means they are theoretically unreliable. However, in practice, updates are almost always picked up correctly.

Example usage

# This is necessary even in Rails, due to the module name not matching the
# package name.
require 'cloudreactor_wrapper_io'

# Use the environment variables
# PROC_WRAPPER_ENABLE_STATUS_UPDATE_LISTENER (set to TRUE or FALSE)
# PROC_WRAPPER_STATUS_UPDATE_SOCKET_PORT (set to an integer)
# to determine configuration. These environment variables are typically passed
# to the process wrapper which then passes them on to your process.
status_updater = CloudReactorWrapperIO::StatusUpdater.new()

begin
  status_updater.send_update(
    success_count: 1,
    error_count: 2,
    last_status_message: 'running'
  )
ensure
  status_updater.close()
end

More documentation

License

This project is covered by the BSD 2-clause license.

FAQs

Package last updated on 04 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc