question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider introducing a cloud.Function abstraction

See original GitHub issue

i.e. instead of having APIs like:

export declare function cron(name: string, cronTab: string, handler: Action): void;

we would have:

export declare function cron(name: string, cronTab: string, handler: cloud.Function): void;

users would then invoke this by doing:

cloud.timer.cron(..., new cloud.Function({ function: async () => {
      // code to run in aws lambda, or azure function
}});

Pros:

  1. Clearer separation between code that runs at deploy time, and the code we want to eventually run at runtime. Aka: self-documenting.
  2. Stronger ability to catch certain types of issues at pulumi/lint time. (i.e. we could lexically catch users making resources inside of these cloud functions). It would likely not be foolproof. But would help catch a broad set of errors.
  3. Closer programming model to what we have with tasks. i.e. today you do cloud.timer.cron(..., new cloud.Task(..., { function: ... ] ]). Now the programming model for functions running in Lambdas vs Containers is more similar.
  4. Better for teaching/explaining what is going on. Today, our examples are so simple that it just looks like a basic app that runs and doesn’t do anything special. With this split it becomes more obvious “ohhhh, all these functions are running as separate lambdas… but, omg, they all get to party on this ‘table’, which just looks like a variable in source”.
  5. Easier to configure lambdas in the case users need to. for example new cloud.Function( { memory: 256, function: () => { ... } }). (see https://github.com/pulumi/pulumi-cloud/issues/121)

Cons:

  1. verbosity. Though my gut tells me it would be isolated. I think it would help people better structure their code to decide what would be partitioned into a particular lambda.
  2. Superfluousness. As our existing programming model demonstrates, we don’t actually need this. There are also existence proofs for similar systems that also avoid this sort of explicit separation in code. For example, lambdas in C# are either delegates, or become Expression trees. If i write table.Where(c => ... ) what i get is completely dependent on the types of the variables involved, and may not be clear just from perusing the code. This may be a good or bad thing depending on who you talk to 😃
  3. Less “magical”. But maybe there are enough good things about this that that’s acceptable.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
joeduffycommented, Nov 16, 2017

Agree 👍. I put in M9 because I’d like to see us do this “soon”. IMHO, one of the highest priority things to do in our cloud framework backlog, given the widescale impacts.

/cc @CyrusNajmabadi

0reactions
CyrusNajmabadicommented, Oct 30, 2018

Closing as #573 is covering this now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Abstractions and serverless - SoftwareMill Tech Blog
Recovering the abstraction​​ yml descriptor, which fully describes the whole service. It contains details on the provider (as serverless.com can ...
Read more >
Why Is It So Tough to Make a Useful Cloud Abstraction?
Lack of API standardization means abstracting away an underlying IaaS provider is much easier said than done.
Read more >
Cloud Functions overview - Google Cloud
Cloud Functions provides a connective layer of logic that lets you write code to connect and extend cloud services. Listen and respond to...
Read more >
Serverless: The next level of abstraction. | by Nawaz Dhandala
Cloud Provider would take care of installing and maintaining OS, patching it underneath ... Think of serverless as an abstraction over PaaS.
Read more >
Understand cloud abstraction for your IT needs - TechTarget
Let's examine each cloud abstraction option and consider the benefits ... For example, code, workflows and test data created in one PaaS is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found