Skip to content
This repository has been archived by the owner on Aug 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #108 from snowplow/release/0.5.0
Browse files Browse the repository at this point in the history
Release 0.5.0
  • Loading branch information
jbeemster authored Jun 26, 2018
2 parents b26a70f + b1f10b2 commit 7020147
Show file tree
Hide file tree
Showing 31 changed files with 107 additions and 65 deletions.
7 changes: 5 additions & 2 deletions .travis/deploy/tasks/provision.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash -e

pip install --user --upgrade pip
pip install --user release-manager==0.1.0rc3
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
pip2 install --user release-manager==0.1.0
else
pip install --user release-manager==0.1.0
fi
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Version 0.5.0 (2018-06-26)
--------------------------
Configurable max event size for webhook updates (#94)
Update Copyright years to 2016-2018 (#109)
Change reference to "Snowplow" to "Factotum" in copyright notice in README (#93)
Use pip2 instead of pip for OSX build on Travis (#110)

Version 0.4.1 (2017-03-16)
--------------------------
Fix panic!(..) on logging initialization error (#100)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "factotum"
version = "0.4.1"
version = "0.5.0"
authors = ["Ed Lewis <[email protected]>", "Josh Beemster <[email protected]>"]

[dependencies]
Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Factotum

[![Build Status](https://travis-ci.org/snowplow/factotum.svg?branch=master)](https://travis-ci.org/snowplow/factotum) [![Release 0.4.1](http://img.shields.io/badge/release-0.4.1-blue.svg?style=flat)](https://github.com/snowplow/factotum/releases) [![Apache License 2.0](http://img.shields.io/badge/license-Apache--2-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
[![Build Status][travis-image]][travis] [![Release][release-image]][releases] [![Apache License 2.0][license-image]][license]

A dag running tool designed for efficiently running complex jobs with non-trivial dependency trees.

Expand All @@ -15,8 +15,8 @@ A dag running tool designed for efficiently running complex jobs with non-trivia
Assuming you're running **64 bit Linux**:

```{bash}
wget https://bintray.com/artifact/download/snowplow/snowplow-generic/factotum_0.4.1_linux_x86_64.zip
unzip factotum_0.4.1_linux_x86_64.zip
wget https://bintray.com/artifact/download/snowplow/snowplow-generic/factotum_0.5.0_linux_x86_64.zip
unzip factotum_0.5.0_linux_x86_64.zip
./factotum --version
```

Expand Down Expand Up @@ -130,9 +130,9 @@ Factotum is written in **[Rust](https://www.rust-lang.org/)**.

## Copyright and license

Snowplow is copyright 2016 Snowplow Analytics Ltd.
Factotum is copyright 2016-2018 Snowplow Analytics Ltd.

Licensed under the **[Apache License, Version 2.0] [license]** (the "License");
Licensed under the **[Apache License, Version 2.0][license]** (the "License");
you may not use this software except in compliance with the License.

Unless required by applicable law or agreed to in writing, software
Expand All @@ -141,4 +141,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

[travis-image]: https://travis-ci.org/snowplow/factotum.svg?branch=master
[travis]: https://travis-ci.org/snowplow/factotum

[license-image]: http://img.shields.io/badge/license-Apache--2-blue.svg?style=flat
[license]: http://www.apache.org/licenses/LICENSE-2.0

[release-image]: http://img.shields.io/badge/release-0.5.0-blue.svg?style=flat
[releases]: https://github.com/snowplow/factotum/releases
2 changes: 1 addition & 1 deletion src/factotum/executor/execution_strategy/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/executor/execution_strategy/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/executor/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/executor/task_list/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/executor/task_list/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/executor/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/factfile/dot/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/factfile/dot/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/factfile/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/factfile/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/parser/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/parser/schemavalidator/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/parser/schemavalidator/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/parser/templater/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/parser/templater/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/parser/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/sequencer/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/sequencer/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/webhook/jobcontext/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
2 changes: 1 addition & 1 deletion src/factotum/webhook/jobcontext/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down
16 changes: 7 additions & 9 deletions src/factotum/webhook/jobupdate/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand All @@ -20,8 +20,6 @@ static JOB_UPDATE_SCHEMA_NAME: &'static str = "iglu:com.snowplowanalytics.\
static TASK_UPDATE_SCHEMA_NAME: &'static str = "iglu:com.snowplowanalytics.\
factotum/task_update/jsonschema/1-0-0";

const MAX_STDOUT_STDERR_SIZE: usize = 10_000; // 10kb

use factotum::executor::{ExecutionState, ExecutionUpdate, TaskSnapshot,
Transition as ExecutorTransition};
use super::jobcontext::JobContext;
Expand Down Expand Up @@ -215,11 +213,11 @@ pub struct JobUpdate {
transition: Option<JobTransition>,
transitions: Option<Vec<TaskTransition>>,
taskStates: Vec<TaskUpdate>,
tags: HashMap<String,String>
tags: HashMap<String,String>,
}

impl JobUpdate {
pub fn new(context: &JobContext, execution_update: &ExecutionUpdate) -> Self {
pub fn new(context: &JobContext, execution_update: &ExecutionUpdate, max_stdouterr_size: &usize) -> Self {
JobUpdate {
jobName: context.job_name.clone(),
jobReference: context.job_reference.clone(),
Expand All @@ -231,7 +229,7 @@ impl JobUpdate {
&execution_update.task_snapshot),
startTime: to_string_datetime(&context.start_time),
runDuration: (UTC::now() - context.start_time).to_string(),
taskStates: JobUpdate::to_task_states(&execution_update.task_snapshot),
taskStates: JobUpdate::to_task_states(&execution_update.task_snapshot, &max_stdouterr_size),
transition: {
match execution_update.transition {
ExecutorTransition::Job(ref j) => {
Expand Down Expand Up @@ -285,7 +283,7 @@ impl JobUpdate {
json::encode(&wrapped).unwrap()
}

fn to_task_states(tasks: &TaskSnapshot) -> Vec<TaskUpdate> {
fn to_task_states(tasks: &TaskSnapshot, max_stdouterr_size: &usize) -> Vec<TaskUpdate> {
use chrono::duration::Duration as ChronoDuration;

tasks.iter()
Expand All @@ -312,7 +310,7 @@ impl JobUpdate {
},
stdout: if let Some(ref r) = task.run_result {
if let Some(ref stdout) = r.stdout {
Some(tail_n_chars(stdout, MAX_STDOUT_STDERR_SIZE).into())
Some(tail_n_chars(stdout, *max_stdouterr_size).into())
} else {
None
}
Expand All @@ -321,7 +319,7 @@ impl JobUpdate {
},
stderr: if let Some(ref r) = task.run_result {
if let Some(ref stderr) = r.stderr {
Some(tail_n_chars(stderr, MAX_STDOUT_STDERR_SIZE).into())
Some(tail_n_chars(stderr, *max_stdouterr_size).into())
} else {
None
}
Expand Down
32 changes: 21 additions & 11 deletions src/factotum/webhook/jobupdate/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2016 Snowplow Analytics Ltd. All rights reserved.
// Copyright (c) 2016-2018 Snowplow Analytics Ltd. All rights reserved.
//
// This program is licensed to you under the Apache License Version 2.0, and
// you may not use this file except in compliance with the Apache License
Expand Down Expand Up @@ -39,7 +39,8 @@ fn to_json_valid_against_schema_job_transition() {
vec![],
Transition::Job(ExecutorJobTransition::new(Some(ExecutionState::Running),
ExecutionState::Finished)));
let job_update = JobUpdate::new(&context, &exec_update);
let max_stdouterr_size: usize = 10_000;
let job_update = JobUpdate::new(&context, &exec_update, &max_stdouterr_size);
let json_wrapped = job_update.as_self_desc_json();
println!("{}", json_wrapped);
let result = schemavalidator::validate_schema(&json_wrapped, schema);
Expand Down Expand Up @@ -82,7 +83,8 @@ fn to_json_valid_against_schema_task_transition_running_to_failed() {
tasks,
Transition::Task(transitions));

let job_update = JobUpdate::new(&context, &exec_update);
let max_stdouterr_size: usize = 10_000;
let job_update = JobUpdate::new(&context, &exec_update, &max_stdouterr_size);
let json_wrapped = job_update.as_self_desc_json();

println!("{}", json_wrapped);
Expand Down Expand Up @@ -123,7 +125,8 @@ fn to_json_valid_against_schema_task_transition_waiting_to_running() {
tasks,
Transition::Task(transitions));

let job_update = JobUpdate::new(&context, &exec_update);
let max_stdouterr_size: usize = 10_000;
let job_update = JobUpdate::new(&context, &exec_update, &max_stdouterr_size);
let json_wrapped = job_update.as_self_desc_json();
println!("{}", json_wrapped);

Expand All @@ -137,7 +140,8 @@ fn to_json_valid_against_schema_task_transition_waiting_to_running() {
#[test]
fn to_task_states_empty() {
let empty = vec![];
assert!(JobUpdate::to_task_states(&empty).is_empty());
let max_stdouterr_size: usize = 10_000;
assert!(JobUpdate::to_task_states(&empty, &max_stdouterr_size).is_empty());
}

#[test]
Expand All @@ -150,7 +154,8 @@ fn headers_correct() {
vec![],
Transition::Job(ExecutorJobTransition::new(Some(ExecutionState::Running),
ExecutionState::Finished)));
let job_update = JobUpdate::new(&context, &exec_update);
let max_stdouterr_size: usize = 10_000;
let job_update = JobUpdate::new(&context, &exec_update, &max_stdouterr_size);

assert_eq!(context.job_reference, job_update.jobReference);
assert_eq!(context.run_reference, job_update.runReference);
Expand Down Expand Up @@ -187,7 +192,8 @@ fn failed_headers_correct() {
tasks,
Transition::Job(ExecutorJobTransition::new(Some(ExecutionState::Running),
ExecutionState::Finished)));
let upd = JobUpdate::new(&context, &exec_update);
let max_stdouterr_size: usize = 10_000;
let upd = JobUpdate::new(&context, &exec_update, &max_stdouterr_size);

assert_eq!(upd.runState, JobRunState::FAILED);
}
Expand All @@ -205,7 +211,8 @@ fn task_states_converted_no_run_data() {
ExecutionState::Started)));

let context = JobContext::new("hello", "world", None);
let job_update = JobUpdate::new(&context, &start_sample);
let max_stdouterr_size: usize = 10_000;
let job_update = JobUpdate::new(&context, &start_sample, &max_stdouterr_size);

let expected_state = TaskUpdate {
taskName: "chocolate".to_string(),
Expand Down Expand Up @@ -256,7 +263,8 @@ fn task_states_converted_with_run_data() {
ExecutionState::Started)));

let context = JobContext::new("hello", "world", None);
let job_update = JobUpdate::new(&context, &start_sample);
let max_stdouterr_size: usize = 10_000;
let job_update = JobUpdate::new(&context, &start_sample, &max_stdouterr_size);

let expected_states = vec![TaskUpdate {
taskName: "chocolate".to_string(),
Expand Down Expand Up @@ -345,7 +353,8 @@ fn big_task_stdout_trimmed() {
ExecutionState::Started)));

let context = JobContext::new("hello", "world", None);
let job_update = JobUpdate::new(&context, &start_sample);
let max_stdouterr_size: usize = 10_000;
let job_update = JobUpdate::new(&context, &start_sample, &max_stdouterr_size);


let expected_str = format!("{}tail", make_n_char_string(max_len-"tail".len()));
Expand Down Expand Up @@ -403,7 +412,8 @@ fn big_task_stderr_trimmed() {
ExecutionState::Started)));

let context = JobContext::new("hello", "world", None);
let job_update = JobUpdate::new(&context, &start_sample);
let max_stdouterr_size: usize = 10_000;
let job_update = JobUpdate::new(&context, &start_sample, &max_stdouterr_size);


let expected_str = format!("{}tail", make_n_char_string(max_len-"tail".len()));
Expand Down
Loading

0 comments on commit 7020147

Please sign in to comment.